Skip to content

Commit 4d8e7de

Browse files
committed
Removed no needed code + edit
1 parent 63f915d commit 4d8e7de

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
@@ -314,21 +314,7 @@ void WiFiClient::setTimeout(uint32_t seconds)
314314
{
315315
_lastReadTimeout = Client::getTimeout();
316316
_lastWriteTimeout = _lastReadTimeout;
317-
Client::setTimeout(seconds * 1000); // This should be here?
318317
_timeout = seconds * 1000;
319-
320-
// if(fd() >= 0) {
321-
// struct timeval tv;
322-
// tv.tv_sec = seconds;
323-
// tv.tv_usec = 0;
324-
// if(setSocketOption(SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval)) < 0) {
325-
// return -1;
326-
// }
327-
// return setSocketOption(SO_SNDTIMEO, (char *)&tv, sizeof(struct timeval));
328-
// }
329-
// else {
330-
// return 0;
331-
// }
332318
}
333319

334320
int WiFiClient::setOption(int option, int *value)
@@ -405,10 +391,10 @@ size_t WiFiClient::write(const uint8_t *buf, size_t size)
405391

406392
if(_lastWriteTimeout != _timeout){
407393
if(fd() >= 0){
408-
struct timeval tv;
409-
tv.tv_sec = _timeout/1000;
410-
tv.tv_usec = 0;
411-
if(setSocketOption(SO_SNDTIMEO, (char *)&tv, sizeof(struct timeval)) >= 0)
394+
struct timeval timeout_tv;
395+
timeout_tv.tv_sec = _timeout/1000;
396+
timeout_tv.tv_usec = 0;
397+
if(setSocketOption(SO_SNDTIMEO, (char *)&timeout_tv, sizeof(struct timeval)) >= 0)
412398
{
413399
_lastWriteTimeout = _timeout;
414400
}
@@ -476,10 +462,10 @@ int WiFiClient::read(uint8_t *buf, size_t size)
476462
{
477463
if(_lastReadTimeout != _timeout){
478464
if(fd() >= 0){
479-
struct timeval tv;
480-
tv.tv_sec = _timeout/1000;
481-
tv.tv_usec = 0;
482-
if(setSocketOption(SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval)) >= 0)
465+
struct timeval timeout_tv;
466+
timeout_tv.tv_sec = _timeout/1000;
467+
timeout_tv.tv_usec = 0;
468+
if(setSocketOption(SO_RCVTIMEO, (char *)&timeout_tv, sizeof(struct timeval)) >= 0)
483469
{
484470
_lastReadTimeout = _timeout;
485471
}

0 commit comments

Comments
 (0)