diff options
author | eutarass | 2009-08-20 20:44:00 +0000 |
---|---|---|
committer | eutarass | 2009-08-20 20:44:00 +0000 |
commit | f416dbde4e459f56fe8329e22389b104e5fa738c (patch) | |
tree | b30aad8f9a3d69568b05ba176cb02fd002a1669b | |
parent | 2f06832741e259c7f86b499fed55e17a149da86e (diff) | |
download | org.eclipse.tcf.agent-f416dbde4e459f56fe8329e22389b104e5fa738c.tar.gz org.eclipse.tcf.agent-f416dbde4e459f56fe8329e22389b104e5fa738c.tar.xz org.eclipse.tcf.agent-f416dbde4e459f56fe8329e22389b104e5fa738c.zip |
1. TCF Agent: Fixed: a socket must be closed after pending read is canceled, not before
2. TCF Agent: Added sending error code when channel is terminated
-rw-r--r-- | channel_tcp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/channel_tcp.c b/channel_tcp.c index b2ad4b9d..9e226645 100644 --- a/channel_tcp.c +++ b/channel_tcp.c @@ -470,13 +470,13 @@ static void send_eof_and_close(Channel * channel, int err) { tcp_write_stream(&c->chan.out, MARKER_EOM); tcp_flush_stream(&c->chan.out); shutdown(c->socket, SHUT_RDWR); - closesocket(c->socket); - c->socket = -1; if (c->read_pending != 0) { /* shutdown should make sure the wait is minimal */ cancel_event(tcp_channel_read_done, &c->rdreq, 1); c->read_pending = 0; } + closesocket(c->socket); + c->socket = -1; notify_channel_closed(channel); if (channel->disconnected) channel->disconnected(channel); tcp_unlock(channel); @@ -512,7 +512,7 @@ static void handle_channel_msg(void * x) { else { trace(LOG_ALWAYS, "Exception in message handler: %d %s", trap.error, errno_to_str(trap.error)); - channel_close(&c->chan); + send_eof_and_close(&c->chan, trap.error); return; } if (c->ibuf.handling_msg == HandleMsgIdle) { |