removed logging code
clear pendingData after socket throws IOException at write