Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libwebsockets
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Fork
libwebsockets
Commits
ba38a7e6
Commit
ba38a7e6
authored
9 years ago
by
Andy Green
Browse files
Options
Downloads
Patches
Plain Diff
ws ping buffer allocate in wsi ws union member
Signed-off-by:
Andy Green
<
andy.green@linaro.org
>
parent
a4244f08
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lib/client-parser.c
+0
-15
0 additions, 15 deletions
lib/client-parser.c
lib/libwebsockets.c
+2
-6
2 additions, 6 deletions
lib/libwebsockets.c
lib/parsers.c
+0
-13
0 additions, 13 deletions
lib/parsers.c
lib/private-libwebsockets.h
+3
-4
3 additions, 4 deletions
lib/private-libwebsockets.h
with
5 additions
and
38 deletions
lib/client-parser.c
+
0
−
15
View file @
ba38a7e6
...
...
@@ -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
],
...
...
This diff is collapsed.
Click to expand it.
lib/libwebsockets.c
+
2
−
6
View file @
ba38a7e6
...
...
@@ -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 */
...
...
This diff is collapsed.
Click to expand it.
lib/parsers.c
+
0
−
13
View file @
ba38a7e6
...
...
@@ -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
],
...
...
This diff is collapsed.
Click to expand it.
lib/private-libwebsockets.h
+
3
−
4
View file @
ba38a7e6
...
...
@@ -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
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment