joyent/libuv — Issue #315: unix: reimplement EMFILE trick
Author: bnoordhuis
Created: 2012-02-18 00:31:39+00:00
State: open
Labels: Unix

Stash away an open file descriptor. When EMFILE is returned by e.g. `accept()`, close the spare and retry the operation, then close the new file descriptor. (Note: not foolproof in multi-threaded environments.)

This is good because it signals to peers that we're overloaded / stops connections from rotting away in the listen backlog. It also mitigates issues like joyent/node#2529.