Skip to content

Commit 12699eb

Browse files
committed
Removed no needed code + edit
1 parent 5564372 commit 12699eb

File tree

1 file changed

+8
-22
lines changed

1 file changed

+8
-22
lines changed

libraries/WiFi/src/WiFiClient.cpp

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -335,21 +335,7 @@ void WiFiClient::setTimeout(uint32_t seconds)
335335
{
336336
_lastReadTimeout = Client::getTimeout();
337337
_lastWriteTimeout = _lastReadTimeout;
338-
Client::setTimeout(seconds * 1000); // This should be here?
339338
_timeout = seconds * 1000;
340-
341-
// if(fd() >= 0) {
342-
// struct timeval tv;
343-
// tv.tv_sec = seconds;
344-
// tv.tv_usec = 0;
345-
// if(setSocketOption(SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval)) < 0) {
346-
// return -1;
347-
// }
348-
// return setSocketOption(SO_SNDTIMEO, (char *)&tv, sizeof(struct timeval));
349-
// }
350-
// else {
351-
// return 0;
352-
// }
353339
}
354340

355341
int WiFiClient::setOption(int option, int *value)
@@ -422,10 +408,10 @@ size_t WiFiClient::write(const uint8_t *buf, size_t size)
422408

423409
if(_lastWriteTimeout != _timeout){
424410
if(fd() >= 0){
425-
struct timeval tv;
426-
tv.tv_sec = _timeout/1000;
427-
tv.tv_usec = 0;
428-
if(setSocketOption(SO_SNDTIMEO, (char *)&tv, sizeof(struct timeval)) >= 0)
411+
struct timeval timeout_tv;
412+
timeout_tv.tv_sec = _timeout/1000;
413+
timeout_tv.tv_usec = 0;
414+
if(setSocketOption(SO_SNDTIMEO, (char *)&timeout_tv, sizeof(struct timeval)) >= 0)
429415
{
430416
_lastWriteTimeout = _timeout;
431417
}
@@ -493,10 +479,10 @@ int WiFiClient::read(uint8_t *buf, size_t size)
493479
{
494480
if(_lastReadTimeout != _timeout){
495481
if(fd() >= 0){
496-
struct timeval tv;
497-
tv.tv_sec = _timeout/1000;
498-
tv.tv_usec = 0;
499-
if(setSocketOption(SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval)) >= 0)
482+
struct timeval timeout_tv;
483+
timeout_tv.tv_sec = _timeout/1000;
484+
timeout_tv.tv_usec = 0;
485+
if(setSocketOption(SO_RCVTIMEO, (char *)&timeout_tv, sizeof(struct timeval)) >= 0)
500486
{
501487
_lastReadTimeout = _timeout;
502488
}

0 commit comments

Comments
 (0)