fix bug:  socket descriptor possible leakage