Fix two race conditions in sinproc (fixes #114)

Includes (slighly modified) disconnection fix by David Beck (#164)

The handshake is done two-way for sinproc sockets first READY from A to B, then ACCEPTED from B to A. Instead of single ACCEPTED message. When READY is sent pipe is assumed to be able to receive messages but not yet attached to socket so can't send yet. This removes the race condition.

I'm not very sure about the disconnection fix, it seems ok, but It may leak memory somewhere probably.