diff options
author | Matthew Jordan <mjordan@digium.com> | 2014-10-27 02:46:35 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2014-10-27 02:46:35 +0000 |
commit | b23580afe68a42dd4b465a010d09928e5999cde1 (patch) | |
tree | 0fcd99405bb6439642a53211d6f85f4846751838 /res/res_http_websocket.c | |
parent | f3fbcc550ed1a9bd1aa59a9970a6f0103a73627f (diff) |
res/res_http_websocket: Fix minor nits found by wdoekes on r409681
When Moises committed the fixes for WSS (which was a great patch), wdoekes had
a few style nits that were on the review that got missed. This patch resolves
what I *think* were all of the ones that were still on the review.
Thanks to both moy for the patch, and wdoekes for the reviews.
Review: https://reviewboard.asterisk.org/r/3248/
........
Merged revisions 426209 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 426210 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@426211 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_http_websocket.c')
-rw-r--r-- | res/res_http_websocket.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/res/res_http_websocket.c b/res/res_http_websocket.c index 8ec85114d..ca144b0d4 100644 --- a/res/res_http_websocket.c +++ b/res/res_http_websocket.c @@ -416,27 +416,27 @@ static inline int ws_safe_read(struct ast_websocket *session, char *buf, int len for (sanity = 10; sanity; sanity--) { clearerr(session->f); rlen = fread(rbuf, 1, xlen, session->f); - if (0 == rlen && ferror(session->f) && errno != EAGAIN) { + if (!rlen && ferror(session->f) && errno != EAGAIN) { ast_log(LOG_ERROR, "Error reading from web socket: %s\n", strerror(errno)); - (*opcode) = AST_WEBSOCKET_OPCODE_CLOSE; + *opcode = AST_WEBSOCKET_OPCODE_CLOSE; session->closing = 1; return -1; } - xlen = (xlen - rlen); + xlen = xlen - rlen; rbuf = rbuf + rlen; - if (0 == xlen) { + if (!xlen) { break; } if (ast_wait_for_input(session->fd, 1000) < 0) { ast_log(LOG_ERROR, "ast_wait_for_input returned err: %s\n", strerror(errno)); - (*opcode) = AST_WEBSOCKET_OPCODE_CLOSE; + *opcode = AST_WEBSOCKET_OPCODE_CLOSE; session->closing = 1; return -1; } } if (!sanity) { ast_log(LOG_WARNING, "Websocket seems unresponsive, disconnecting ...\n"); - (*opcode) = AST_WEBSOCKET_OPCODE_CLOSE; + *opcode = AST_WEBSOCKET_OPCODE_CLOSE; session->closing = 1; return -1; } @@ -502,7 +502,7 @@ int AST_OPTIONAL_API_NAME(ast_websocket_read)(struct ast_websocket *session, cha return -1; } - if (ws_safe_read(session, (*payload), (*payload_len), opcode)) { + if (ws_safe_read(session, *payload, *payload_len, opcode)) { return 0; } /* If a mask is present unmask the payload */ @@ -839,7 +839,7 @@ static void websocket_echo_callback(struct ast_websocket *session, struct ast_va } end: - ast_debug(1, "Exitting WebSocket echo loop\n"); + ast_debug(1, "Exiting WebSocket echo loop\n"); ast_websocket_unref(session); } |