lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #28853] recv() returns 0 on receive time-out / any net


From: Stephane Lesage
Subject: [lwip-devel] [bug #28853] recv() returns 0 on receive time-out / any netconn_recv() error
Date: Tue, 09 Feb 2010 18:48:29 +0000
User-agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

Follow-up Comment #2, bug #28853 (project lwip):

Re,

actually my patch is wrong because it returns -1 on close.
this is better:

diff -u -r1.147 sockets.c
--- sockets.c   8 Feb 2010 17:25:57 -0000       1.147
+++ sockets.c   9 Feb 2010 18:42:15 -0000
@@ -544,7 +544,7 @@
         LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): buf == NULL, error
is "%s"!n",
           s, lwip_strerr(err)));
         sock_set_errno(sock, err_to_errno(err));
-        return 0;
+        return (err == ERR_CLSD) ? 0 : -1;
       }
       LWIP_ASSERT("buf != NULL", buf != NULL);
       sock->lastdata = buf;


BTW, on receive time-out, netconn_recv() returns ERR_TIMEOUT (which is a
fatal error !) and translates as ETIMEDOUT in socket domain, which is wrong:

"If a receive operation has blocked for this much time without receiving
additional data, it shall return with a partial count or errno set to [EAGAIN]
or [EWOULDBLOCK] if no data is received."

[http://www.opengroup.org/onlinepubs/000095399/functions/setsockopt.html]





    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?28853>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.nongnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]