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
d99476b2
Commit
d99476b2
authored
11 years ago
by
Andy Green
Browse files
Options
Downloads
Patches
Plain Diff
refactor move flow control to server.c
Signed-off-by:
Andy Green
<
andy.green@linaro.org
>
parent
e38031a3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lib/libwebsockets.c
+0
-41
0 additions, 41 deletions
lib/libwebsockets.c
lib/private-libwebsockets.h
+3
-0
3 additions, 0 deletions
lib/private-libwebsockets.h
lib/server.c
+35
-0
35 additions, 0 deletions
lib/server.c
lib/service.c
+1
-1
1 addition, 1 deletion
lib/service.c
with
39 additions
and
42 deletions
lib/libwebsockets.c
+
0
−
41
View file @
d99476b2
...
@@ -524,48 +524,7 @@ lws_latency(struct libwebsocket_context *context, struct libwebsocket *wsi,
...
@@ -524,48 +524,7 @@ lws_latency(struct libwebsocket_context *context, struct libwebsocket *wsi,
}
}
#endif
#endif
#ifdef LWS_NO_SERVER
int
_libwebsocket_rx_flow_control
(
struct
libwebsocket
*
wsi
)
{
return
0
;
}
#else
int
_libwebsocket_rx_flow_control
(
struct
libwebsocket
*
wsi
)
{
struct
libwebsocket_context
*
context
=
wsi
->
protocol
->
owning_server
;
/* there is no pending change */
if
(
!
(
wsi
->
u
.
ws
.
rxflow_change_to
&
LWS_RXFLOW_PENDING_CHANGE
))
return
0
;
/* stuff is still buffered, not ready to really accept new input */
if
(
wsi
->
u
.
ws
.
rxflow_buffer
)
{
/* get ourselves called back to deal with stashed buffer */
libwebsocket_callback_on_writable
(
context
,
wsi
);
return
0
;
}
/* pending is cleared, we can change rxflow state */
wsi
->
u
.
ws
.
rxflow_change_to
&=
~
LWS_RXFLOW_PENDING_CHANGE
;
lwsl_info
(
"rxflow: wsi %p change_to %d
\n
"
,
wsi
,
wsi
->
u
.
ws
.
rxflow_change_to
&
LWS_RXFLOW_ALLOW
);
/* adjust the pollfd for this wsi */
if
(
wsi
->
u
.
ws
.
rxflow_change_to
&
LWS_RXFLOW_ALLOW
)
{
if
(
lws_change_pollfd
(
wsi
,
0
,
LWS_POLLIN
))
return
-
1
;
}
else
if
(
lws_change_pollfd
(
wsi
,
LWS_POLLIN
,
0
))
return
-
1
;
return
1
;
}
#endif
/**
/**
* libwebsocket_rx_flow_control() - Enable and disable socket servicing for
* libwebsocket_rx_flow_control() - Enable and disable socket servicing for
...
...
This diff is collapsed.
Click to expand it.
lib/private-libwebsockets.h
+
3
−
0
View file @
d99476b2
...
@@ -756,6 +756,9 @@ LWS_EXTERN int openssl_websocket_private_data_index;
...
@@ -756,6 +756,9 @@ LWS_EXTERN int openssl_websocket_private_data_index;
LWS_EXTERN
int
lws_server_socket_service
(
LWS_EXTERN
int
lws_server_socket_service
(
struct
libwebsocket_context
*
context
,
struct
libwebsocket_context
*
context
,
struct
libwebsocket
*
wsi
,
struct
libwebsocket_pollfd
*
pollfd
);
struct
libwebsocket
*
wsi
,
struct
libwebsocket_pollfd
*
pollfd
);
LWS_EXTERN
int
_libwebsocket_rx_flow_control
(
struct
libwebsocket
*
wsi
);
#else
#define _libwebsocket_rx_flow_control(_a) (0)
#endif
#endif
/*
/*
...
...
This diff is collapsed.
Click to expand it.
lib/server.c
+
35
−
0
View file @
d99476b2
...
@@ -128,6 +128,41 @@ int lws_context_init_server(struct lws_context_creation_info *info,
...
@@ -128,6 +128,41 @@ int lws_context_init_server(struct lws_context_creation_info *info,
return
0
;
return
0
;
}
}
int
_libwebsocket_rx_flow_control
(
struct
libwebsocket
*
wsi
)
{
struct
libwebsocket_context
*
context
=
wsi
->
protocol
->
owning_server
;
/* there is no pending change */
if
(
!
(
wsi
->
u
.
ws
.
rxflow_change_to
&
LWS_RXFLOW_PENDING_CHANGE
))
return
0
;
/* stuff is still buffered, not ready to really accept new input */
if
(
wsi
->
u
.
ws
.
rxflow_buffer
)
{
/* get ourselves called back to deal with stashed buffer */
libwebsocket_callback_on_writable
(
context
,
wsi
);
return
0
;
}
/* pending is cleared, we can change rxflow state */
wsi
->
u
.
ws
.
rxflow_change_to
&=
~
LWS_RXFLOW_PENDING_CHANGE
;
lwsl_info
(
"rxflow: wsi %p change_to %d
\n
"
,
wsi
,
wsi
->
u
.
ws
.
rxflow_change_to
&
LWS_RXFLOW_ALLOW
);
/* adjust the pollfd for this wsi */
if
(
wsi
->
u
.
ws
.
rxflow_change_to
&
LWS_RXFLOW_ALLOW
)
{
if
(
lws_change_pollfd
(
wsi
,
0
,
LWS_POLLIN
))
return
-
1
;
}
else
if
(
lws_change_pollfd
(
wsi
,
LWS_POLLIN
,
0
))
return
-
1
;
return
1
;
}
#ifdef LWS_OPENSSL_SUPPORT
#ifdef LWS_OPENSSL_SUPPORT
static
void
static
void
...
...
This diff is collapsed.
Click to expand it.
lib/service.c
+
1
−
1
View file @
d99476b2
...
@@ -454,7 +454,7 @@ drain:
...
@@ -454,7 +454,7 @@ drain:
free
(
wsi
->
u
.
ws
.
rxflow_buffer
);
free
(
wsi
->
u
.
ws
.
rxflow_buffer
);
wsi
->
u
.
ws
.
rxflow_buffer
=
NULL
;
wsi
->
u
.
ws
.
rxflow_buffer
=
NULL
;
/* having drained the rxflow buffer, can rearm POLLIN */
/* having drained the rxflow buffer, can rearm POLLIN */
_libwebsocket_rx_flow_control
(
wsi
);
n
=
_libwebsocket_rx_flow_control
(
wsi
);
/* n ignored, needed for NO_SERVER case */
}
}
#ifdef LWS_OPENSSL_SUPPORT
#ifdef LWS_OPENSSL_SUPPORT
...
...
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