fix a bug of tcp server: segment fault caused by disconnect