Skip to content

Commit f474f94

Browse files
jrowbergsandeepmistry
authored andcommitted
Fix socket initialization condition
The socket() method returns a socket handle (0+) on success or -1 on failure. The original condition therefore only initializes the socket state and parent value after the first TCP socket is created.
1 parent d601bc8 commit f474f94

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utility/WiFiSocket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ SOCKET WiFiSocketClass::create(uint16 u16Domain, uint8 u8Type, uint8 u8Flags)
6666
{
6767
SOCKET sock = socket(u16Domain, u8Type, u8Flags);
6868

69-
if (sock > 0) {
69+
if (sock >= 0) {
7070
_info[sock].state = SOCKET_STATE_IDLE;
7171
_info[sock].parent = -1;
7272
}

0 commit comments

Comments
 (0)