lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] tcp_listen_with_backlog [RAW]


From: Kieran Mansley
Subject: Re: [lwip-users] tcp_listen_with_backlog [RAW]
Date: Mon, 27 Jul 2009 11:12:56 +0100

On Mon, 2009-07-27 at 03:03 -0700, Chris_S wrote:
> Well I found the source of my TCP dying on the 3rd page refresh:
> tcp_listen()
> 
> I had the lwipopts.h set to:
> 
> #define TCP_LISTEN_BACKLOG                        1
> #define TCP_DEFAULT_LISTEN_BACKLOG    5
> 
> and the server HTTP.c module was calling "tcp_listen()"
> That caused the problem.  It was a backlog issue.
> 
> I set:
> 
> #define TCP_LISTEN_BACKLOG                      0

Sounds like you've got a workaround at least, but there should be no
problem with that code.

> and no problem with multiple page refreshes.
> 
> However I then modified the server HTTP.c so it calls
> 
> if  (TCP_LISTEN_BACKLOG==1)
>     tcp_listen_with_backlog(pcb,backlog)
>         else tcp_listen(pcb)
> 
> My question is, what is the "backlog" param value suppose to be?
> I set it to TCP_DEFAULT_LISTEN_BACKLOG.

That's very odd, as tcp_listen is defined to be:

#define          tcp_listen(pcb) tcp_listen_with_backlog(pcb, 
TCP_DEFAULT_LISTEN_BACKLOG)

so there should be no difference between the two lines in your
modification.

> So far, if I try to use the backlog function, it doesn't keep working.
> It keeps exiting at:
> 
> #if TCP_LISTEN_BACKLOG
>     if (pcb->accepts_pending >= pcb->backlog) {
>    printf("ERROR! pcb->accepts_pending >= pcb->backlog\n");
>       return ERR_ABRT;
>       }
> #endif /* TCP_LISTEN_BACKLOG */
> 
> in "tcp_listen_input()" in TCP_IN.H.
> 
> 
> Is this backlog function not working?  Not working in Raw?

That suggests that there are more accepted connections pending than are
allowed by the selected backlog.  i.e. you've selected a certain number
of connections to queue waiting for an accept() call, and then another
connection has arrived, and it can't queue this one, so it drops it.

Kieran





reply via email to

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