This is HostileFork's "notorious TCP bug (EVM_DEVICE events allowing ports to GC)" fix minimized. It is meant as an alternative to his pull request.