From 947471903b5099c6465ab2e474891decc0753059 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Thu, 28 Sep 2023 09:58:48 +0200 Subject: [PATCH 1/2] fix(client): setTimeout shadows Stream.setTimeout Rename it setConnectionTimeout to match Arduino Ethernet API. Fixes #72 Signed-off-by: Frederic Pillon --- keywords.txt | 1 + src/EthernetClient.cpp | 2 +- src/EthernetClient.h | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/keywords.txt b/keywords.txt index 367603a..e4af683 100644 --- a/keywords.txt +++ b/keywords.txt @@ -34,6 +34,7 @@ getSocketNumber KEYWORD2 localIP KEYWORD2 MACAddress KEYWORD2 maintain KEYWORD2 +setConnectionTimeout KEYWORD2 ####################################### # Constants (LITERAL1) diff --git a/src/EthernetClient.cpp b/src/EthernetClient.cpp index 4fd0a7f..b4ad99c 100644 --- a/src/EthernetClient.cpp +++ b/src/EthernetClient.cpp @@ -76,7 +76,7 @@ int EthernetClient::connect(IPAddress ip, uint16_t port) startTime = millis(); while (_tcp_client->state == TCP_NONE) { stm32_eth_scheduler(); - if ((_tcp_client->state == TCP_CLOSING) || ((millis() - startTime) >= _timeout)) { + if ((_tcp_client->state == TCP_CLOSING) || ((millis() - startTime) >= _connectionTimeout)) { stop(); return 0; } diff --git a/src/EthernetClient.h b/src/EthernetClient.h index c937a05..5afb160 100644 --- a/src/EthernetClient.h +++ b/src/EthernetClient.h @@ -52,9 +52,9 @@ class EthernetClient : public Client { { return (_tcp_client->pcb->remote_port); }; - void setTimeout(uint16_t timeout) + void setConnectionTimeout(uint16_t timeout) { - _timeout = timeout; + _connectionTimeout = timeout; } friend class EthernetServer; @@ -63,7 +63,7 @@ class EthernetClient : public Client { private: struct tcp_struct *_tcp_client; - uint16_t _timeout = 10000; + uint16_t _connectionTimeout = 10000; }; #endif From 6d46fb08c953119a9dd462fe790b0106bb54417e Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Thu, 28 Sep 2023 09:59:37 +0200 Subject: [PATCH 2/2] chore(keywords.txt): add missing keywords Signed-off-by: Frederic Pillon --- keywords.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/keywords.txt b/keywords.txt index e4af683..09e494c 100644 --- a/keywords.txt +++ b/keywords.txt @@ -24,7 +24,9 @@ peek KEYWORD2 flush KEYWORD2 stop KEYWORD2 connected KEYWORD2 +accept KEYWORD2 begin KEYWORD2 +beginMulticast KEYWORD2 beginPacket KEYWORD2 endPacket KEYWORD2 parsePacket KEYWORD2 @@ -32,11 +34,17 @@ remoteIP KEYWORD2 remotePort KEYWORD2 getSocketNumber KEYWORD2 localIP KEYWORD2 -MACAddress KEYWORD2 +localPort KEYWORD2 maintain KEYWORD2 +linkStatus KEYWORD2 +MACAddress KEYWORD2 +subnetMask KEYWORD2 +gatewayIP KEYWORD2 +dnsServerIP KEYWORD2 setConnectionTimeout KEYWORD2 ####################################### # Constants (LITERAL1) ####################################### - +LinkON LITERAL1 +LinkOFF LITERAL1