diff options
author | Kevin Harwell <kharwell@digium.com> | 2015-02-11 16:52:55 +0000 |
---|---|---|
committer | Kevin Harwell <kharwell@digium.com> | 2015-02-11 16:52:55 +0000 |
commit | 137c4b0778928040dff81f15b770211ee1ead320 (patch) | |
tree | ea094ab1134e7fd99571857eb1f9e951e8950b52 /res/res_http_websocket.c | |
parent | 49161d8df80925ff674204d288ba491876530715 (diff) |
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. Also a notice is logged stating that the websocket was
disconnected.
ASTERISK-24701 #close
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/4412/
........
Merged revisions 431669 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 431670 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431671 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_http_websocket.c')
-rw-r--r-- | res/res_http_websocket.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/res/res_http_websocket.c b/res/res_http_websocket.c index 4930bcc42..d1beae6c2 100644 --- a/res/res_http_websocket.c +++ b/res/res_http_websocket.c @@ -307,11 +307,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); |