Fix some bugs around sock.on('write'...) and sock.clearOn()

14 jobs for master in 8 minutes and 54 seconds (queued for 13 seconds)
Status Job ID Name Coverage
  Build
passed #18770
FreeBSD
jsdoor-freebsd

00:05:44

passed #18771
Linux
jsdoor-linux

00:03:26

passed #18773
FreeBSD
jsdoor-windows

00:02:39

passed #18765
FreeBSD
sbbs-freebsd

00:07:56

passed #18760
Linux
sbbs-linux

00:08:50

passed #18763
Windows
sbbs-windows

00:05:15

passed #18772
FreeBSD
sexpots-freebsd

00:00:26

passed #18761
Linux
sexpots-linux

00:00:46

passed #18764
Windows
sexpots-windows

00:00:24

passed #18768
FreeBSD
syncdraw-freebsd

00:00:47

passed #18769
Linux
syncdraw-linux

00:00:22

passed #18766
FreeBSD
syncterm-freebsd

00:01:41

passed #18762
Linux
syncterm-linux

00:02:30

passed #18767
FreeBSD
syncterm-windows

00:02:41