Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of PicoTCP by
Diff: Socket/TCPSocketConnection.cpp
- Revision:
- 35:6078073547bb
- Parent:
- 29:1a47b7151851
- Child:
- 37:bdf736327c71
diff -r d868bb69114e -r 6078073547bb Socket/TCPSocketConnection.cpp
--- a/Socket/TCPSocketConnection.cpp Thu Jun 20 13:48:41 2013 +0000
+++ b/Socket/TCPSocketConnection.cpp Fri Jun 21 08:47:35 2013 +0000
@@ -68,14 +68,13 @@
if ((_ep < 0) || !_is_connected)
return -1;
- if (!_blocking) {
- TimeInterval timeout(_timeout);
- if (wait_writable(timeout) != 0)
- {
- printf("Failed\n");
- return -1;
- }
+ TimeInterval timeout(!_blocking ? _timeout : osWaitForever);
+ if (wait_writable(timeout) != 0)
+ {
+ printf("Failed\n");
+ return -1;
}
+
ret = picotcp_write(_ep, data, length);
if (ret < length) {
_ep->revents &= (~PICO_SOCK_EV_WR);
@@ -90,12 +89,11 @@
if ((_ep < 0) || !_is_connected)
return -1;
- if (!_blocking) {
- TimeInterval timeout(_timeout);
- // Wait for socket to be writeable
- if (wait_writable(timeout) != 0) {
- return 0;
- }
+
+ TimeInterval timeout(!_blocking? _timeout : osWaitForever);
+ // Wait for socket to be writeable
+ if (wait_writable(timeout) != 0) {
+ return 0;
}
ret = picotcp_write(_ep, data, length);
if (ret < length) {
@@ -110,14 +108,14 @@
if ((_ep < 0) || !_is_connected)
return -1;
- if (!_blocking) {
- TimeInterval timeout(_timeout);
- if (wait_readable(timeout) != 0)
- {
- printf("Failed receiving\n");
- return -1;
- }
+
+ TimeInterval timeout(!_blocking ? _timeout : osWaitForever);
+ if (wait_readable(timeout) != 0)
+ {
+ printf("Failed receiving\n");
+ return -1;
}
+
ret = picotcp_read(_ep, data, length);
if (ret < length) {
_ep->revents &= (~PICO_SOCK_EV_RD);
