Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit be067d9

Browse filesBrowse files
committed
client: Fix bool operator on init and ongoing use
When iterating we make sure client's socket is not closing since _tcp_client remains after close. This was tested on nuleo-f767zi using project webthing-arduino Change-Id: Ie465fe59009c33957dad97f1c70b4dc3af3b2ebe Forwarded: #17 Signed-off-by: Philippe Coval <p.coval@samsung.com>
1 parent a1db02b commit be067d9
Copy full SHA for be067d9

File tree

Expand file treeCollapse file tree

1 file changed

+5
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-3
lines changed

‎src/EthernetClient.cpp

Copy file name to clipboardExpand all lines: src/EthernetClient.cpp
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ extern "C" {
99
#include "EthernetServer.h"
1010
#include "Dns.h"
1111

12-
EthernetClient::EthernetClient() {
12+
EthernetClient::EthernetClient()
13+
:_tcp_client(NULL) {
1314
}
1415

1516
/* Deprecated constructor. Keeps compatibility with W5100 architecture
1617
sketches but sock is ignored. */
17-
EthernetClient::EthernetClient(uint8_t sock) {
18+
EthernetClient::EthernetClient(uint8_t sock)
19+
:_tcp_client(NULL) {
1820
UNUSED(sock);
1921
}
2022

@@ -181,7 +183,7 @@ uint8_t EthernetClient::status() {
181183
// EthernetServer::available() as the condition in an if-statement.
182184

183185
EthernetClient::operator bool() {
184-
return _tcp_client != NULL;
186+
return (_tcp_client && (_tcp_client->state != TCP_CLOSING));
185187
}
186188

187189
bool EthernetClient::operator==(const EthernetClient& rhs) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.