From: Kevin Harwell Date: Wed, 11 Feb 2015 16:46:12 +0000 (+0000) Subject: res_http_websocket: websocket write timeout fails to fully disconnect X-Git-Tag: 11.17.0-rc1~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1720c411def49a55079f9c669e2735e34a16d4c;p=thirdparty%2Fasterisk.git res_http_websocket: websocket write timeout fails to fully disconnect When writing to a websocket if a timeout occurred the underlying socket did not get closed/disconnected. This patch makes sure the websocket gets disconnected on a write timeout. ASTERISK-24701 #close Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/4412/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@431669 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_http_websocket.c b/res/res_http_websocket.c index fbaf133fa0..4bcdd5382e 100644 --- a/res/res_http_websocket.c +++ b/res/res_http_websocket.c @@ -255,11 +255,15 @@ int AST_OPTIONAL_API_NAME(ast_websocket_write)(struct ast_websocket *session, en if (ast_careful_fwrite(session->f, session->fd, frame, header_size, session->timeout)) { ao2_unlock(session); + /* 1011 - server terminating connection due to not being able to fulfill the request */ + ast_websocket_close(session, 1011); return -1; } if (ast_careful_fwrite(session->f, session->fd, payload, actual_length, session->timeout)) { ao2_unlock(session); + /* 1011 - server terminating connection due to not being able to fulfill the request */ + ast_websocket_close(session, 1011); return -1; } fflush(session->f);