File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -220,9 +220,8 @@ void EthernetClient::stop()
220
220
gettimeofday (&startTime, NULL );
221
221
222
222
// wait up to a second for the connection to close
223
- uint8_t s;
224
223
do {
225
- s = status ();
224
+ uint8_t s = status ();
226
225
if (s == ETHERNETCLIENT_W5100_CLOSED) {
227
226
break ; // exit the loop
228
227
}
@@ -231,10 +230,8 @@ void EthernetClient::stop()
231
230
} while (((curTime.tv_sec - startTime.tv_sec ) * 1000000 ) + (curTime.tv_usec - startTime.tv_usec ) <
232
231
1000000 );
233
232
234
- // if it hasn't closed, close it forcefully
235
- if (s != ETHERNETCLIENT_W5100_CLOSED) {
236
- ::close (_sock);
237
- }
233
+ // free up the socket descriptor
234
+ ::close (_sock);
238
235
_sock = -1 ;
239
236
}
240
237
Original file line number Diff line number Diff line change @@ -155,13 +155,11 @@ size_t EthernetServer::write(uint8_t b)
155
155
size_t EthernetServer::write (const uint8_t *buffer, size_t size)
156
156
{
157
157
size_t n = 0 ;
158
- size_t i = 0 ;
159
158
160
- while (i < clients.size ()) {
159
+ for ( size_t i = 0 ; i < clients.size (); ++i ) {
161
160
EthernetClient client (clients[i]);
162
161
if (client.status () == ETHERNETCLIENT_W5100_ESTABLISHED) {
163
162
n += client.write (buffer, size);
164
- i++;
165
163
}
166
164
}
167
165
You can’t perform that action at this time.
0 commit comments