Solve connection disconnection bug.
Delete the connection when read or write gets EAGAIN or EWOULDBLOCK.
Add libpthread to Makefile.