Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): setTimeout shadows Stream.setTimeout #74

Merged
merged 2 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,27 @@ peek KEYWORD2
flush KEYWORD2
stop KEYWORD2
connected KEYWORD2
accept KEYWORD2
begin KEYWORD2
beginMulticast KEYWORD2
beginPacket KEYWORD2
endPacket KEYWORD2
parsePacket KEYWORD2
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
2 changes: 1 addition & 1 deletion src/EthernetClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions src/EthernetClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -63,7 +63,7 @@ class EthernetClient : public Client {

private:
struct tcp_struct *_tcp_client;
uint16_t _timeout = 10000;
uint16_t _connectionTimeout = 10000;
};

#endif