-
Notifications
You must be signed in to change notification settings - Fork 613
confused me:why use an empty job for sync in listener_accept_func #100
Comments
Hi, |
On the other hand I suppose the code could be changed to just do the minimum necessary in listener_accept_func, instead of running event loop processing, i.e. no SYNC_COMMIT and related stuff, always return ERR_OK. But it would not be optimal since we would delay sending/receiving that can be done right, so lwIP might do something suboptimal because of that. Probably not a big issue though. |
Ah, I think I remember, generally the pattern is that within a lwIP callback I directly run event loop jobs that have resulted from whatever actions were just started (e.g. adding a packet to a buffer), to make sure that all data processing that can be done is done right away - this is what the SYNC_COMMIT does. Without this, if lwIP gives us another packet right afterward, we might not be able to place it in the buffer at all, due to the way that the data processing pipeline works - the processing from the previous packet might be pending on the job queue still, so not ready to handle another packet. |
Thank you. @ambrop72 |
`
err_t listener_accept_func (void *arg, struct tcp_pcb *newpcb, err_t err)
{
DEAD_ENTER(client->dead_aborted)
SYNC_COMMIT
DEAD_LEAVE2(client->dead_aborted)
`
I can not understand why you need to handle ERR_ABRT?
In my opinion,there is only one thread in tun2socks,then we occpied the thread in function "listener_accept_func".
can you answer me. thank you. @ambrop72
The text was updated successfully, but these errors were encountered: