From c3780ae27f97a161c6bb5846947fba6605e45281 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 2 Apr 2016 20:40:17 -0500 Subject: [PATCH] wsockd: try to flush ircd-side recvq when we call close_conn() this is so that a websocket client may receive it's ERROR message if available --- wsockd/wsockd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wsockd/wsockd.c b/wsockd/wsockd.c index 5780ffc7..65a03e5e 100644 --- a/wsockd/wsockd.c +++ b/wsockd/wsockd.c @@ -181,6 +181,7 @@ strcasestr(const char *s, const char *find) static void close_conn(conn_t * conn, int wait_plain, const char *fmt, ...); static void conn_mod_read_cb(rb_fde_t *fd, void *data); static void conn_plain_read_cb(rb_fde_t *fd, void *data); +static void conn_plain_process_recvq(conn_t *conn); #define FLAG_CORK 0x01 #define FLAG_DEAD 0x02 @@ -459,6 +460,9 @@ close_conn(conn_t * conn, int wait_plain, const char *fmt, ...) if(IsDead(conn)) return; + if (IsKeyed(conn)) + conn_plain_process_recvq(conn); + rb_rawbuf_flush(conn->modbuf_out, conn->mod_fd); rb_linebuf_flush(conn->plain_fd, &conn->plainbuf_out); rb_close(conn->mod_fd);