mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
PPP, PPPoS, improve the freeing of remaining RX pbuf if PPP_INPROC_MULTITHREADED is not enabled
If PPP_INPROC_MULTITHREADED is not enabled, we can free unfinished RX pbuf from the pppos_disconnect() function because pppos_input() is running in the same context. Thanks to the pppos->open flags we now only need to free remaining pbuf in the disconnect function if PPP_INPROC_MULTITHREADED is not enabled.
This commit is contained in:
parent
02598d1e91
commit
636ff411f1
@ -392,8 +392,10 @@ pppos_connect(ppp_pcb *ppp, void *ctx)
|
||||
{
|
||||
pppos_pcb *pppos = (pppos_pcb *)ctx;
|
||||
|
||||
#if PPP_INPROC_MULTITHREADED
|
||||
/* input pbuf left over from last session? */
|
||||
pppos_free_current_input_packet(pppos);
|
||||
#endif /* PPP_INPROC_MULTITHREADED */
|
||||
|
||||
ppp_clear(ppp);
|
||||
/* reset PPPoS control block to its initial state */
|
||||
@ -429,8 +431,10 @@ pppos_listen(ppp_pcb *ppp, void *ctx, struct ppp_addrs *addrs)
|
||||
#endif /* PPP_IPV4_SUPPORT */
|
||||
lcp_options *lcp_wo;
|
||||
|
||||
#if PPP_INPROC_MULTITHREADED
|
||||
/* input pbuf left over from last session? */
|
||||
pppos_free_current_input_packet(pppos);
|
||||
#endif /* PPP_INPROC_MULTITHREADED */
|
||||
|
||||
ppp_clear(ppp);
|
||||
/* reset PPPoS control block to its initial state */
|
||||
@ -490,9 +494,15 @@ pppos_disconnect(ppp_pcb *ppp, void *ctx)
|
||||
pppos->open = 0;
|
||||
PPPOS_UNPROTECT(lev);
|
||||
|
||||
/* We cannot call pppos_free_current_input_packet() here because
|
||||
* rx thread might still call pppos_input()
|
||||
/* If PPP_INPROC_MULTITHREADED is used we cannot call
|
||||
* pppos_free_current_input_packet() here because
|
||||
* rx thread might still call pppos_input().
|
||||
*/
|
||||
#if !PPP_INPROC_MULTITHREADED
|
||||
/* input pbuf left ? */
|
||||
pppos_free_current_input_packet(pppos);
|
||||
#endif /* !PPP_INPROC_MULTITHREADED */
|
||||
|
||||
ppp_link_end(ppp); /* notify upper layers */
|
||||
}
|
||||
|
||||
@ -502,8 +512,10 @@ pppos_destroy(ppp_pcb *ppp, void *ctx)
|
||||
pppos_pcb *pppos = (pppos_pcb *)ctx;
|
||||
LWIP_UNUSED_ARG(ppp);
|
||||
|
||||
#if PPP_INPROC_MULTITHREADED
|
||||
/* input pbuf left ? */
|
||||
pppos_free_current_input_packet(pppos);
|
||||
#endif /* PPP_INPROC_MULTITHREADED */
|
||||
|
||||
memp_free(MEMP_PPPOS_PCB, pppos);
|
||||
return ERR_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user