File tree Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -114,10 +114,10 @@ class SocketAddress {
114
114
*/
115
115
void set_port (uint16_t port);
116
116
117
- /* * Get the human readable IP address
117
+ /* * Get the human- readable IP address
118
118
*
119
119
* Allocates memory for a string and converts binary address to
120
- * human readable format. String is freed in the destructor.
120
+ * human- readable format. String is freed in the destructor.
121
121
*
122
122
* @return Null-terminated representation of the IP Address
123
123
*/
@@ -153,7 +153,7 @@ class SocketAddress {
153
153
*/
154
154
operator bool () const ;
155
155
156
- /* * Copy addres from another SocketAddress
156
+ /* * Copy address from another SocketAddress
157
157
*
158
158
* @param addr SocketAddress to copy
159
159
*/
Original file line number Diff line number Diff line change @@ -249,21 +249,22 @@ TCPSocket *TCPSocket::accept(nsapi_error_t *error)
249
249
{
250
250
_lock.lock ();
251
251
TCPSocket *connection = NULL ;
252
+ nsapi_error_t ret;
252
253
253
254
_readers++;
254
255
255
256
while (true ) {
256
257
if (!_socket) {
257
- *error = NSAPI_ERROR_NO_SOCKET;
258
+ ret = NSAPI_ERROR_NO_SOCKET;
258
259
break ;
259
260
}
260
261
261
262
_pending = 0 ;
262
263
void *socket;
263
264
SocketAddress address;
264
- *error = _stack->socket_accept (_socket, &socket, &address);
265
+ ret = _stack->socket_accept (_socket, &socket, &address);
265
266
266
- if (0 == *error ) {
267
+ if (0 == ret ) {
267
268
TCPSocket *connection = new TCPSocket ();
268
269
connection->_lock .lock ();
269
270
connection->_factory_allocated = true ; // Destroy automatically on close()
@@ -275,7 +276,7 @@ TCPSocket *TCPSocket::accept(nsapi_error_t *error)
275
276
276
277
connection->_lock .unlock ();
277
278
break ;
278
- } else if ((_timeout == 0 ) || (*error != NSAPI_ERROR_WOULD_BLOCK)) {
279
+ } else if ((_timeout == 0 ) || (ret != NSAPI_ERROR_WOULD_BLOCK)) {
279
280
break ;
280
281
} else {
281
282
uint32_t flag;
@@ -288,7 +289,7 @@ TCPSocket *TCPSocket::accept(nsapi_error_t *error)
288
289
289
290
if (flag & osFlagsError) {
290
291
// Timeout break
291
- *error = NSAPI_ERROR_WOULD_BLOCK;
292
+ ret = NSAPI_ERROR_WOULD_BLOCK;
292
293
break ;
293
294
}
294
295
}
@@ -299,5 +300,8 @@ TCPSocket *TCPSocket::accept(nsapi_error_t *error)
299
300
_event_flag.set (FINISHED_FLAG);
300
301
}
301
302
_lock.unlock ();
303
+ if (error) {
304
+ *error = ret;
305
+ }
302
306
return connection;
303
307
}
Original file line number Diff line number Diff line change @@ -34,8 +34,6 @@ nsapi_protocol_t UDPSocket::get_proto()
34
34
35
35
nsapi_error_t UDPSocket::connect (const SocketAddress &address)
36
36
{
37
- if (!address)
38
- return NSAPI_ERROR_PARAMETER;
39
37
_remote_peer = address;
40
38
return NSAPI_ERROR_OK;
41
39
}
You can’t perform that action at this time.
0 commit comments