Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change use of ReadWriteStream* to IDataSourceStream* where appropriate #1588

Merged
merged 2 commits into from
Feb 1, 2019

Conversation

mikee47
Copy link
Contributor

@mikee47 mikee47 commented Jan 29, 2019

Changes to parameter types, member variables
MultiStreamand StreamTransformer classes now inherit from IDataSourceStream instead of ReadWriteStream; this affects all inherited classes

With TcpClient, a stream is used for outgoing data so should be inherited from IDataSourceStream, not ReadWriteStream. An additional internal 'buffer' ReadWriteStream is used where necessary.
This is also done for the HttpResponseclass.

@slaff slaff added this to the 3.7.2 milestone Jan 29, 2019
@@ -174,22 +173,25 @@ bool HttpResponse::sendDataStream(ReadWriteStream* newDataStream, const String&
}
stream = newDataStream;

if(!headers.contains(HTTP_HEADER_TRANSFER_ENCODING) && stream->available() < 0) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible change to behaviour; perhaps revert for now

stream = nullptr;
}

FileStream* fileStream;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should follow original more closely

bool TcpClient::send(const char* data, uint16_t len, bool forceCloseAfterSent /* = false*/)
{
if(state != eTCS_Connecting && state != eTCS_Connected)
return false;

if(stream == NULL)
stream = new MemoryDataStream();
if(buffer != nullptr) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this follow original more closely?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this follow original more closely?
There are a few places I could reduce changes to existing code

I would say yes.

@mikee47
Copy link
Contributor Author

mikee47 commented Jan 30, 2019

There are a few places I could reduce changes to existing code; I've more extensive changes planned in subsequent PRs, wishing to avoid any side effects here.

@slaff
Copy link
Contributor

slaff commented Feb 1, 2019

@mikee47 Can you rebase that PR on the latest develop? I want to be sure that the CS check passes before I merge it into develop?

…riate

Changes to parameter types, member variables
`MultiStream`and `StreamTransformer` classes now inherit from `IDataSourceStream` instead of `ReadWriteStream`; this affects all inherited classes

With `TcpClient`, a stream is used for outgoing data so should be inherited from IDataSourceStream, not ReadWriteStream. An additional internal 'buffer' ReadWriteStream is used where necessary.
This is also done for the `HttpResponse`class.
@mikee47
Copy link
Contributor Author

mikee47 commented Feb 1, 2019

@mikee47 Can you rebase that PR on the latest develop? I want to be sure that the CS check passes before I merge it into develop?

OK, have rebased & pushed.

@slaff slaff merged commit 531cb06 into SmingHub:develop Feb 1, 2019
@slaff slaff removed the 3 - Review label Feb 1, 2019
@mikee47 mikee47 deleted the fix/datastream branch February 1, 2019 22:27
mikee47 added a commit to mikee47/Sming that referenced this pull request Feb 3, 2019
slaff pushed a commit that referenced this pull request Feb 4, 2019
mikee47 added a commit to mikee47/Sming that referenced this pull request Feb 5, 2019
@slaff slaff mentioned this pull request Feb 27, 2019
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants