ws ping buffer allocate in wsi ws union member
Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
parent
a4244f08ad
commit
ba38a7e6b4
4 changed files with 5 additions and 38 deletions
|
@ -302,21 +302,6 @@ spill:
|
|||
goto ping_drop;
|
||||
}
|
||||
|
||||
/* if existing buffer is too small, drop it */
|
||||
if (wsi->u.ws.ping_payload_buf &&
|
||||
wsi->u.ws.ping_payload_alloc <
|
||||
wsi->u.ws.rx_user_buffer_head)
|
||||
lws_free_set_NULL(wsi->u.ws.ping_payload_buf);
|
||||
|
||||
/* if no buffer, allocate it */
|
||||
if (!wsi->u.ws.ping_payload_buf) {
|
||||
wsi->u.ws.ping_payload_buf =
|
||||
lws_malloc(wsi->u.ws.rx_user_buffer_head +
|
||||
LWS_SEND_BUFFER_PRE_PADDING);
|
||||
wsi->u.ws.ping_payload_alloc =
|
||||
wsi->u.ws.rx_user_buffer_head;
|
||||
}
|
||||
|
||||
/* stash the pong payload */
|
||||
memcpy(wsi->u.ws.ping_payload_buf + LWS_SEND_BUFFER_PRE_PADDING,
|
||||
&wsi->u.ws.rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING],
|
||||
|
|
|
@ -234,12 +234,8 @@ just_kill_connection:
|
|||
/* not going to be completed... nuke it */
|
||||
lws_free_set_NULL(wsi->trunc_alloc);
|
||||
|
||||
if (wsi->u.ws.ping_payload_buf) {
|
||||
lws_free_set_NULL(wsi->u.ws.ping_payload_buf);
|
||||
wsi->u.ws.ping_payload_alloc = 0;
|
||||
wsi->u.ws.ping_payload_len = 0;
|
||||
wsi->u.ws.ping_pending_flag = 0;
|
||||
}
|
||||
wsi->u.ws.ping_payload_len = 0;
|
||||
wsi->u.ws.ping_pending_flag = 0;
|
||||
}
|
||||
|
||||
/* tell the user it's all over for this guy */
|
||||
|
|
|
@ -964,19 +964,6 @@ process_as_ping:
|
|||
goto ping_drop;
|
||||
}
|
||||
|
||||
/* if existing buffer is too small, drop it */
|
||||
if (wsi->u.ws.ping_payload_buf &&
|
||||
wsi->u.ws.ping_payload_alloc < wsi->u.ws.rx_user_buffer_head) {
|
||||
lws_free_set_NULL(wsi->u.ws.ping_payload_buf);
|
||||
}
|
||||
|
||||
/* if no buffer, allocate it */
|
||||
if (!wsi->u.ws.ping_payload_buf) {
|
||||
wsi->u.ws.ping_payload_buf = lws_malloc(wsi->u.ws.rx_user_buffer_head
|
||||
+ LWS_SEND_BUFFER_PRE_PADDING);
|
||||
wsi->u.ws.ping_payload_alloc = wsi->u.ws.rx_user_buffer_head;
|
||||
}
|
||||
|
||||
/* stash the pong payload */
|
||||
memcpy(wsi->u.ws.ping_payload_buf + LWS_SEND_BUFFER_PRE_PADDING,
|
||||
&wsi->u.ws.rx_user_buffer[LWS_SEND_BUFFER_PRE_PADDING],
|
||||
|
|
|
@ -831,11 +831,10 @@ struct _lws_websocket_related {
|
|||
unsigned int inside_frame:1; /* next write will be more of frame */
|
||||
unsigned int clean_buffer:1; /* buffer not rewritten by extension */
|
||||
unsigned int payload_is_close:1; /* process as PONG, but it is close */
|
||||
unsigned int ping_pending_flag:1;
|
||||
|
||||
unsigned char *ping_payload_buf; /* non-NULL if malloc'd */
|
||||
unsigned int ping_payload_alloc; /* length malloc'd */
|
||||
unsigned int ping_payload_len;
|
||||
unsigned char ping_pending_flag;
|
||||
unsigned char ping_payload_buf[128 - 4]; /* control opc == < 124 */
|
||||
unsigned char ping_payload_len;
|
||||
};
|
||||
|
||||
struct lws {
|
||||
|
|
Loading…
Add table
Reference in a new issue