Set connection error correctly on read/write errors. Final bit for
fix of #10.
This commit is contained in:
@@ -21,6 +21,8 @@
|
|||||||
#else
|
#else
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#define ETIMEOUT WSAETIMEOUT
|
#define ETIMEOUT WSAETIMEOUT
|
||||||
|
#define ECONNRESET WSAECONNRESET
|
||||||
|
#define ECONNABORTED WSAECONNABORTED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "strophe.h"
|
#include "strophe.h"
|
||||||
@@ -86,7 +88,8 @@ void xmpp_run_once(xmpp_ctx_t *ctx, const unsigned long timeout)
|
|||||||
if (conn->error) {
|
if (conn->error) {
|
||||||
/* FIXME: need to tear down send queues and random other things
|
/* FIXME: need to tear down send queues and random other things
|
||||||
* maybe this should be abstracted */
|
* 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);
|
conn_disconnect(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +201,8 @@ void xmpp_run_once(xmpp_ctx_t *ctx, const unsigned long timeout)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* return of 0 means socket closed by server */
|
/* 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);
|
conn_disconnect(conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user