lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #22435] lwip_recvfrom with TCP break;


From: Frédéric Bernon
Subject: [lwip-devel] [bug #22435] lwip_recvfrom with TCP break;
Date: Thu, 28 Feb 2008 14:44:30 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12

Update of bug #22435 (project lwip):

                  Status:                    None => Confirmed              
             Assigned to:                    None => fbernon                

    _______________________________________________________

Follow-up Comment #1:

You're right, but your patch is not very thread-safe, since you use
conn->pcb.tcp in the application context, and you can have a err_tcp before
you fetch your packet. That's why we have add netconn_getaddr to query the
peer.

So, I suggest this patch in lwip_recvfrom :

...
  /* Check to see from where the data was.*/
  if (from && fromlen) {
    struct sockaddr_in sin;

    if (netconn_type(sock->conn) == NETCONN_TCP) {
      addr = (struct ip_addr*)&(sin.sin_addr.s_addr);
      netconn_getaddr(sock->conn, addr, &port, 0);
    } else {
      addr = netbuf_fromaddr(buf);
      port = netbuf_fromport(buf);
    }
...

It got the advantage to avoid an extra thread-context switching for most of
case where recv (and not directly recvfrom) is used for a TCP socket (in this
case, from and fromlen are NULL).

I will propose a nicest patch this evening to integrate in 1.3.0.

But a better solution will be to post directly netbuf in the recv_tcp like
for udp and raw callbacks. But this idea is more for post-1.3.0.





    _______________________________________________________

Reply to this item at:

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

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





reply via email to

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