Skip to content

Commit d4ef80e

Browse files
zagornashif
authored andcommitted
net: tcp: Release connect() semaphore if connection is refused
Connecting to a non-open port causes connect() to hang forever. This patch releases connect() to return error to the caller. Signed-off-by: Björn Stenberg <[email protected]>
1 parent 076fd6a commit d4ef80e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

subsys/net/ip/tcp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2198,6 +2198,8 @@ NET_CONN_CB(tcp_synack_received)
21982198

21992199
net_stats_update_tcp_seg_rst(net_pkt_iface(pkt));
22002200

2201+
k_sem_give(&context->tcp->connect_wait);
2202+
22012203
if (context->connect_cb) {
22022204
context->connect_cb(context, -ECONNREFUSED,
22032205
context->user_data);

0 commit comments

Comments
 (0)