fix two bugs

1.the first msg sended by client lost in server;
2.when the client terminates in accident,the server would exit.