[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #48416] Problem with nonblocking connect
From: |
Christian Prochaska |
Subject: |
[lwip-devel] [bug #48416] Problem with nonblocking connect |
Date: |
Tue, 5 Jul 2016 18:29:27 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0 |
URL:
<http://savannah.nongnu.org/bugs/?48416>
Summary: Problem with nonblocking connect
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: cproc
Submitted on: Tue 05 Jul 2016 06:29:25 PM GMT
Category: sockets/netconn
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release: None
lwIP version: git head
_______________________________________________________
Details:
I'm actually not using the most recent version, but from looking at the source
code the problem I'm having seems to still exist on the current git master
branch (4b136d631af0650247ab1bb21c7eb761d12960b6)
In 'lwip_netconn_do_connect()':
...
case NETCONN_TCP:
/* Prevent connect while doing any other action. */
if (msg->conn->state == NETCONN_CONNECT) {
msg->err = ERR_ALREADY;
} else if (msg->conn->state != NETCONN_NONE) {
msg->err = ERR_ISCONN;
} else {
setup_tcp(msg->conn);
msg->err = tcp_connect(msg->conn->pcb.tcp,
API_EXPR_REF(msg->msg.bc.ipaddr),
msg->msg.bc.port, lwip_netconn_do_connected);
if (msg->err == ERR_OK) {
u8_t non_blocking = netconn_is_nonblocking(msg->conn);
msg->conn->state = NETCONN_CONNECT;
...
The problem occurred when the function was called for the second time when the
connection was already established. I would have expected an 'ERR_ISCONN'
status code, but instead tcp_connect() got called for a second time and
printed a 'tcp_connect: can only connect from state CLOSED' error message (the
actual state was ESTABLISHED).
The reason for the repeated call of 'tcp_connect()' was that
'msg->conn->state' was NETCONN_NONE, as set in 'lwip_netconn_do_connected()'
after the connection was established.
Perhaps a new netconn state 'NETCONN_CONNECTED' would be needed here, but I'm
not too familiar with lwip interna to be sure about that.
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?48416>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [lwip-devel] [bug #48416] Problem with nonblocking connect,
Christian Prochaska <=