0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

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
This commit is contained in:
William Pitcock 2016-04-02 20:40:17 -05:00
parent 7428c4e07e
commit c3780ae27f

View file

@ -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);