Use a constant for disconnected socket

The socket is set to -1 when it is disconnected, which is also checked
for in multiple places. This is prone to errors. Replace the literal
with a more descriptive constant.

Signed-off-by: Marcus Karlsson <mk@acc.umu.se>