NetworkSocketAPI
Dependents: HelloWizFi250Interface
Fork of NetworkSocketAPI by
Revision 117:ff83eb6a1ab9, committed 2016-04-20
- Comitter:
- Christopher Haster
- Date:
- Wed Apr 20 19:48:17 2016 -0500
- Parent:
- 116:bc043343d753
- Child:
- 118:96627c4b83d5
- Commit message:
- Fix bug in timeout logic
Changed in this revision
--- a/TCPServer.cpp Wed Apr 20 19:20:51 2016 -0500 +++ b/TCPServer.cpp Wed Apr 20 19:48:17 2016 -0500 @@ -61,8 +61,7 @@ } if (err != NSAPI_ERROR_WOULD_BLOCK - || _timeout < 0 - || timer.read_ms() > _timeout) { + || (_timeout >= 0 && timer.read_ms() > _timeout)) { return err; }
--- a/TCPSocket.cpp Wed Apr 20 19:20:51 2016 -0500 +++ b/TCPSocket.cpp Wed Apr 20 19:48:17 2016 -0500 @@ -62,8 +62,7 @@ int sent = _iface->socket_send(_socket, data, size); if (sent != NSAPI_ERROR_WOULD_BLOCK - || _timeout < 0 - || timer.read_ms() > _timeout) { + || (_timeout >= 0 && timer.read_ms() > _timeout)) { return sent; } @@ -83,8 +82,7 @@ int recv = _iface->socket_recv(_socket, data, size); if (recv != NSAPI_ERROR_WOULD_BLOCK - || _timeout < 0 - || timer.read_ms() > _timeout) { + || (_timeout >= 0 && timer.read_ms() > _timeout)) { return recv; }
--- a/UDPSocket.cpp Wed Apr 20 19:20:51 2016 -0500 +++ b/UDPSocket.cpp Wed Apr 20 19:48:17 2016 -0500 @@ -53,8 +53,7 @@ int sent = _iface->socket_sendto(_socket, address, data, size); if (sent != NSAPI_ERROR_WOULD_BLOCK - || _timeout < 0 - || timer.read_ms() > _timeout) { + || (_timeout >= 0 && timer.read_ms() > _timeout)) { return sent; } @@ -74,8 +73,7 @@ int recv = _iface->socket_recvfrom(_socket, address, buffer, size); if (recv != NSAPI_ERROR_WOULD_BLOCK - || _timeout < 0 - || timer.read_ms() > _timeout) { + || (_timeout >= 0 && timer.read_ms() > _timeout)) { return recv; }