From fd8fe6104cd95ec30d9dfd4d13be164a9dc4d71d Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Sat, 16 Jun 2012 10:49:08 +0200 Subject: [PATCH] EVENT-Client: don't call the timeout function directly - if we call the timeout function directly we might find upper stackframes which rely on the event-context still being valid. Thus we rather set a timeout of 0.0 which then calls the timeout function and kills the context. --- citadel/event_client.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/citadel/event_client.c b/citadel/event_client.c index 774d3e86c..bd0b8a105 100644 --- a/citadel/event_client.c +++ b/citadel/event_client.c @@ -585,10 +585,14 @@ IO_send_callback(struct ev_loop *loop, ev_io *watcher, int revents) } else if (rc < 0) { if (errno != EAGAIN) { + StopClientWatchers(IO); EV_syslog(LOG_DEBUG, "EVENT: Socket Invalid! [%d] [%s] [%d]\n", errno, strerror(errno), IO->SendBuf.fd); - IO_Timeout_callback(loop, &IO->rw_timeout, revents); + StrBufPrintf(IO->ErrMsg, + "Socket Invalid! [%s]", + strerror(errno)); + SetNextTimeout(IO, 0.0); } } /* else : must write more. */ @@ -808,7 +812,7 @@ IO_recv_callback(struct ev_loop *loop, ev_io *watcher, int revents) if (nbytes > 0) { HandleInbound(IO); } else if (nbytes == 0) { - IO_Timeout_callback(loop, &IO->rw_timeout, revents); + SetNextTimeout(IO, 0.0); return; } else if (nbytes == -1) { if (errno != EAGAIN) { @@ -817,7 +821,10 @@ IO_recv_callback(struct ev_loop *loop, ev_io *watcher, int revents) EV_syslog(LOG_DEBUG, "EVENT: Socket Invalid! [%d] [%s] [%d]\n", errno, strerror(errno), IO->SendBuf.fd); - ShutDownCLient(IO); + StrBufPrintf(IO->ErrMsg, + "Socket Invalid! [%s]", + strerror(errno)); + SetNextTimeout(IO, 0.0); } return; } -- 2.30.2