[svn-commits] mjordan: branch 11 r426209 - /branches/11/res/res_http_websocket.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Oct 26 21:45:15 CDT 2014


Author: mjordan
Date: Sun Oct 26 21:45:09 2014
New Revision: 426209

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=426209
Log:
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/


Modified:
    branches/11/res/res_http_websocket.c

Modified: branches/11/res/res_http_websocket.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/res_http_websocket.c?view=diff&rev=426209&r1=426208&r2=426209
==============================================================================
--- branches/11/res/res_http_websocket.c (original)
+++ branches/11/res/res_http_websocket.c Sun Oct 26 21:45:09 2014
@@ -364,27 +364,27 @@
 	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;
 	}
@@ -450,7 +450,7 @@
 			return -1;
 		}
 
-		if (ws_safe_read(session, (*payload), (*payload_len), opcode)) {
+		if (ws_safe_read(session, *payload, *payload_len, opcode)) {
 			return 0;
 		}
 
@@ -735,7 +735,7 @@
 	}
 
 end:
-	ast_debug(1, "Exitting WebSocket echo loop\n");
+	ast_debug(1, "Exiting WebSocket echo loop\n");
 	ast_websocket_unref(session);
 }
 




More information about the svn-commits mailing list