This is correct. I think we don't want to count an error if we kill an old
PCB and then are able to successfully allocate one. Do we really have an
error if we are able to kill a PCB to release one?
I added the else below in red (in tcp_alloc) and the error count is
adjusted:
pcb = memp_malloc(MEMP_TCP_PCB);
if (pcb == NULL) {
/* Try killing oldest connection in TIME-WAIT. */
LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing off oldest TIME-WAIT
connection\n"));
tcp_kill_timewait();
/* Try to allocate a tcp_pcb again. */
pcb = memp_malloc(MEMP_TCP_PCB);
if (pcb == NULL) {
/* Try killing active connections with lower priority than the new
one. */
tcp_kill_prio(prio);
/* Try to allocate a tcp_pcb again. */
pcb = memp_malloc(MEMP_TCP_PCB);
}
else {
#if MEMP_STATS
--lwip_stats.memp[MEMP_TCP_PCB].err;
#endif /* MEMP_STATS */
}
}
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf
> Of Pettinato, Jim
> Sent: Friday, February 08, 2008 3:33 PM
> To: Mailing list for lwIP users
> Subject: RE: [lwip-users] BasicWeb.c behavior
>
>
> I think the issue they're expressing is that the PCB memory pool's
> associated stats.err member gets incremented in this case even though the
> fail/kill/retry sequence ends up being successful?
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:lwip-
> [EMAIL PROTECTED] On Behalf Of Jonathan
> Larmour
> Sent: Friday, February 08, 2008 3:03 PM
> To: Mailing list for lwIP users
> Subject: Re: [lwip-users] BasicWeb.c behavior
>
> Bill Auerbach wrote:
> >
> > In tcp_alloc, if memp_malloc returns NULL then tcp_kill_timewait is
> > used to kill an old PCB. I would think the error should be reversed
> > when the next memp_malloc succeeds, or, we need a memp_malloc_try
> > which doesn't count the error on a fail, but allocates one if it can.
>
> I'm not sure what you mean here. The current code looks ok to me? It
> retries the memp_malloc straight after killing off a socket in timewait.
>
> Jifl
> --
> eCosCentric Limited http://www.eCosCentric.com/ The eCos experts
> Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571
> Registered in England and Wales: Reg No 4422071.
> Visit us @ Embedded World 2008, Nürnberg, Germany, 26-28 Feb:Stand 11-336
> ------["Si fractum non sit, noli id reficere"]------ Opinions==mine
>
>
> _______________________________________________
> lwip-users mailing list
> [email protected]
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
> _______________________________________________
> lwip-users mailing list
> [email protected]
> http://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users