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
d5466c97
Commit
d5466c97
authored
9 years ago
by
Andy Green
Browse files
Options
Downloads
Patches
Plain Diff
lws_write escalate pending truncated to make the
Signed-off-by:
Andy Green
<
andy@warmcat.com
>
parent
602d8840
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.coding.md
+13
-0
13 additions, 0 deletions
README.coding.md
lib/output.c
+3
-1
3 additions, 1 deletion
lib/output.c
with
16 additions
and
1 deletion
README.coding.md
+
13
−
0
View file @
d5466c97
...
...
@@ -36,6 +36,19 @@ with the socket closing and the `wsi` freed.
Websocket write activities should only take place in the
`LWS_CALLBACK_SERVER_WRITEABLE`
callback as described below.
[
This network-programming necessity to link the issue of new data to
the peer taking the previous data is not obvious to all users so let's
repeat that in other words:
***ONLY DO LWS_WRITE FROM THE WRITEABLE CALLBACK***
There is another network-programming truism that surprises some people which
is if the sink for the data cannot accept more:
***YOU MUST PERFORM RX FLOW CONTROL***
See the mirror protocol implementations for example code.
Only live connections appear in the user callbacks, so this removes any
possibility of trying to used closed and freed wsis.
...
...
This diff is collapsed.
Click to expand it.
lib/output.c
+
3
−
1
View file @
d5466c97
...
...
@@ -109,7 +109,9 @@ int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len)
if
(
wsi
->
trunc_len
&&
(
buf
<
wsi
->
trunc_alloc
||
buf
>
(
wsi
->
trunc_alloc
+
wsi
->
trunc_len
+
wsi
->
trunc_offset
)))
{
lwsl_err
(
"****** %x Sending new, pending truncated ...
\n
"
,
wsi
);
lwsl_err
(
"****** %p: Sending new, pending truncated ...
\n
"
" It's illegal to do an lws_write outside of
\n
"
" the writable callback: fix your code"
,
wsi
);
assert
(
0
);
return
-
1
;
...
...
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