From 5403b39950fc410ee2dae1222d87cf38a89b2bb4 Mon Sep 17 00:00:00 2001 From: Jack Moffitt Date: Thu, 1 Dec 2005 23:43:53 +0000 Subject: [PATCH] Set connection error correctly on read/write errors. Final bit for fix of #10. --- src/event.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/event.c b/src/event.c index 7e2deac..19bc7ac 100644 --- a/src/event.c +++ b/src/event.c @@ -21,6 +21,8 @@ #else #include #define ETIMEOUT WSAETIMEOUT +#define ECONNRESET WSAECONNRESET +#define ECONNABORTED WSAECONNABORTED #endif #include "strophe.h" @@ -86,7 +88,8 @@ void xmpp_run_once(xmpp_ctx_t *ctx, const unsigned long timeout) if (conn->error) { /* FIXME: need to tear down send queues and random other things * maybe this should be abstracted */ - xmpp_debug(ctx, "xmpp", "send error occured, disconnecting"); + xmpp_debug(ctx, "xmpp", "Send error occured, disconnecting."); + conn->error = ECONNABORTED; conn_disconnect(conn); } @@ -198,7 +201,8 @@ void xmpp_run_once(xmpp_ctx_t *ctx, const unsigned long timeout) } } else { /* return of 0 means socket closed by server */ - xmpp_debug(ctx, "xmpp", "socket closed by remote host"); + xmpp_debug(ctx, "xmpp", "Socket closed by remote host."); + conn->error = ECONNRESET; conn_disconnect(conn); } }