You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Say that listen() is run at the beginning of the event loop, but the listening callback is placed in a setImmediate(). Unless a hostname is passed, binding to the port will happen immediately. For the event loop to proceed, it must hit the poll phase, which means there is a non-zero chance that a connection could have been received allowing the connection event to be fired before the listening event.
As I understand it, this paragraph is explaining why the listening callback needs to be placed in the nextTick queue, by saying that if it was a setImmediate(), then it would cause problems.
I think the confusion here is the use of the word Say, I would translate Say as 假如 , as in 假如on('listening')是个setImmediate(),会出......的问题,所以得用process.nextTick().
Activity
gibfahn commentedon Jan 7, 2018
As I understand it, this paragraph is explaining why the listening callback needs to be placed in the
nextTickqueue, by saying that if it was asetImmediate(), then it would cause problems.I think the confusion here is the use of the word
Say, I would translateSayas 假如 , as in 假如on('listening')是个setImmediate(),会出......的问题,所以得用process.nextTick().Original PR to add this was: nodejs/node#4936 FWIW
evanzlj commentedon Jan 7, 2018
Got it! Thanks for your help~~^_^