[asterisk-commits] dlee: trunk r394513 - /trunk/res/stasis_http/ari_websockets.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 16 16:44:14 CDT 2013


Author: dlee
Date: Tue Jul 16 16:44:12 2013
New Revision: 394513

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394513
Log:
Debug logging to help with WebSocket connection problems

Modified:
    trunk/res/stasis_http/ari_websockets.c

Modified: trunk/res/stasis_http/ari_websockets.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/stasis_http/ari_websockets.c?view=diff&rev=394513&r1=394512&r2=394513
==============================================================================
--- trunk/res/stasis_http/ari_websockets.c (original)
+++ trunk/res/stasis_http/ari_websockets.c Tue Jul 16 16:44:12 2013
@@ -99,6 +99,8 @@
 			ast_websocket_fd(session->ws_session), -1);
 
 		if (res <= 0) {
+			ast_log(LOG_WARNING, "WebSocket poll error: %s\n",
+				strerror(errno));
 			return NULL;
 		}
 
@@ -106,14 +108,21 @@
 			&payload_len, &opcode, &fragmented);
 
 		if (res != 0) {
+			ast_log(LOG_WARNING, "WebSocket read error: %s\n",
+				strerror(errno));
 			return NULL;
 		}
 
 		switch (opcode) {
 		case AST_WEBSOCKET_OPCODE_CLOSE:
+			ast_debug(1, "WebSocket closed by peer\n");
 			return NULL;
 		case AST_WEBSOCKET_OPCODE_TEXT:
 			message = ast_json_load_buf(payload, payload_len, NULL);
+			if (message == NULL) {
+				ast_log(LOG_WARNING,
+					"WebSocket input failed to parse\n");
+			}
 			break;
 		default:
 			/* Ignore all other message types */




More information about the asterisk-commits mailing list