-
Notifications
You must be signed in to change notification settings - Fork 51
infinite while loop fix write() and clientWrite() #2
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,15 +41,16 @@ int BearSSLClient::connect(const char* host, uint16_t port) | |
|
||
size_t BearSSLClient::write(uint8_t b) | ||
{ | ||
|
||
return write(&b, sizeof(b)); | ||
} | ||
|
||
size_t BearSSLClient::write(const uint8_t *buf, size_t size) | ||
{ | ||
br_sslio_write_all(&_ioc, buf, size); | ||
br_sslio_flush(&_ioc); | ||
int ret = br_sslio_flush(&_ioc); | ||
|
||
return size; | ||
return ret<0?0:size; | ||
} | ||
|
||
int BearSSLClient::available() | ||
|
@@ -289,5 +290,5 @@ int BearSSLClient::clientWrite(void *ctx, const unsigned char *buf, size_t len) | |
|
||
int w = c->write(buf, len); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The point is that this return allow to break the while in the point of the following link, https://github.com/Rocketct/ArduinoBearSSL/blob/master/src/bearssl/ssl_io.c#L279, in case of GSMClient faillure. |
||
|
||
return w; | ||
return w>0?w:-1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also check the return value of
br_sslio_write_all
?