res_pjsip_transport_websocket: Don't assert on 0 length payloads
authorSean Bright <sean.bright@gmail.com>
Fri, 4 Jan 2019 23:14:45 +0000 (18:14 -0500)
committerGerrit <noreply@gerrit.asterisk.org>
Mon, 14 Jan 2019 15:35:55 +0000 (09:35 -0600)
When --enable-dev-mode is used, pjsip_tpmgr_receive_packet() will assert
if passed a payload length of 0, so treat empty frames as if we didn't
receive them.

Change-Id: I9c5fdccd89cc8d2f3ed7e3ee405ef0fc78178f48

res/res_pjsip_transport_websocket.c

index 2abbf15..73268ea 100644 (file)
@@ -396,7 +396,9 @@ static void websocket_cb(struct ast_websocket *session, struct ast_variable *par
                }
 
                if (opcode == AST_WEBSOCKET_OPCODE_TEXT || opcode == AST_WEBSOCKET_OPCODE_BINARY) {
-                       ast_sip_push_task_wait_serializer(serializer, transport_read, &read_data);
+                       if (read_data.payload_len) {
+                               ast_sip_push_task_wait_serializer(serializer, transport_read, &read_data);
+                       }
                } else if (opcode == AST_WEBSOCKET_OPCODE_CLOSE) {
                        break;
                }