mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
lwip: avoid failed assertion on nonblocking connect()
When calling 'connect()' in nonblocking mode and the connection has been established, don't call 'tcp_connect()' again, which would trigger an assertion with the message 'tcp_connect: can only connect from state CLOSED'. Fixes #2039
This commit is contained in:
parent
1d9f10e3b6
commit
bea48b636e
@ -1 +1 @@
|
||||
cbf1fff1bec6b6033825f81d863bdcd1a6060ed5
|
||||
d84dafd43c71b0c325246801d7f2f5ee8ec7bbd9
|
||||
|
@ -16,7 +16,8 @@ PATCHES := $(addprefix src/lib/lwip/,window_scaling.patch \
|
||||
sockets_c_errno.patch \
|
||||
sol_socket_definition.patch \
|
||||
remove_warnings.patch \
|
||||
api_msg.patch)
|
||||
api_msg.patch \
|
||||
nonblocking_connect.patch)
|
||||
|
||||
PATCH_OPT := -p1 -d src/lib/lwip
|
||||
|
||||
|
26
repos/libports/src/lib/lwip/nonblocking_connect.patch
Normal file
26
repos/libports/src/lib/lwip/nonblocking_connect.patch
Normal file
@ -0,0 +1,26 @@
|
||||
Avoid assertion on nonblocking connect()
|
||||
|
||||
From: Christian Prochaska <christian.prochaska@genode-labs.com>
|
||||
|
||||
When calling 'connect()' in nonblocking mode and the connection has been
|
||||
established, don't call 'tcp_connect()' again, which would trigger an
|
||||
assertion with the message 'tcp_connect: can only connect from state
|
||||
CLOSED'.
|
||||
---
|
||||
src/api/api_msg.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
|
||||
index c00222c..d05a5ae 100644
|
||||
--- a/src/api/api_msg.c
|
||||
+++ b/src/api/api_msg.c
|
||||
@@ -1008,7 +1008,8 @@ lwip_netconn_do_connect(struct api_msg_msg *msg)
|
||||
#if LWIP_TCP
|
||||
case NETCONN_TCP:
|
||||
/* Prevent connect while doing any other action. */
|
||||
- if (msg->conn->state != NETCONN_NONE) {
|
||||
+ if ((msg->conn->state != NETCONN_NONE) ||
|
||||
+ ((msg->conn->pcb.tcp->state == ESTABLISHED) && netconn_is_nonblocking(msg->conn))) {
|
||||
msg->err = ERR_ISCONN;
|
||||
} else {
|
||||
setup_tcp(msg->conn);
|
Loading…
Reference in New Issue
Block a user