unstaged server changes 00/3100/1
authorAndy Green <andy.green@linaro.org>
Thu, 14 Feb 2013 03:25:44 +0000 (11:25 +0800)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Thu, 7 Mar 2013 21:01:35 +0000 (13:01 -0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/parsers.c

index 23c3b94..8fccdeb 100644 (file)
@@ -904,12 +904,27 @@ handle_first:
                                            (wsi->u.ws.frame_mask_index++) & 3];
 
                if (--wsi->u.ws.rx_packet_length == 0) {
+                       /* spill because we have the whole frame */
                        wsi->lws_rx_parse_state = LWS_RXPS_NEW;
                        goto spill;
                }
-               if (wsi->u.ws.rx_user_buffer_head !=
-                                       wsi->protocol->rx_buffer_size)
+
+               /*
+                * if there's no protocol max frame size given, we are
+                * supposed to default to LWS_MAX_SOCKET_IO_BUF
+                */
+
+               if (!wsi->protocol->rx_buffer_size &&
+                                       wsi->u.ws.rx_user_buffer_head !=
+                                                         LWS_MAX_SOCKET_IO_BUF)
                        break;
+               else
+                       if (wsi->protocol->rx_buffer_size &&
+                                       wsi->u.ws.rx_user_buffer_head !=
+                                                 wsi->protocol->rx_buffer_size)
+                       break;
+
+               /* spill because we filled our rx buffer */
 spill:
                /*
                 * is this frame a control packet we should take care of at this