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
ba119e90
Commit
ba119e90
authored
9 years ago
by
Andy Green
Browse files
Options
Downloads
Patches
Plain Diff
lws_adopt_socket
Signed-off-by:
Andy Green
<
andy.green@linaro.org
>
parent
8c1f6026
No related branches found
No related tags found
No related merge requests found
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
changelog
+10
-2
10 additions, 2 deletions
changelog
lib/libwebsockets.h
+3
-0
3 additions, 0 deletions
lib/libwebsockets.h
lib/server.c
+10
-3
10 additions, 3 deletions
lib/server.c
libwebsockets-api-doc.html
+542
-353
542 additions, 353 deletions
libwebsockets-api-doc.html
with
565 additions
and
358 deletions
changelog
+
10
−
2
View file @
ba119e90
...
@@ -208,9 +208,17 @@ discover how many threads were actually allowed when the context was created.
...
@@ -208,9 +208,17 @@ discover how many threads were actually allowed when the context was created.
It's required to implement locking in the user code in the same way that
It's required to implement locking in the user code in the same way that
libwebsockets-test-server-pthread does it, for the FD locking callbacks.
libwebsockets-test-server-pthread does it, for the FD locking callbacks.
There is no knowledge or dependency in lws itself about pthreads. How the
If LWS_MAX_SMP=1, then there is no code related to pthreads compiled in the
locking is implemented is entirely up to the user code.
library. If more than 1, a small amount of pthread mutex code is built into
the library.
8) New API
LWS_VISIBLE struct lws *
lws_adopt_socket(struct lws_context *context, lws_sockfd_type accept_fd)
allows foreign sockets accepted by non-lws code to be adopted by lws as if they
had just been accepted by lws' own listen socket.
User api changes
User api changes
----------------
----------------
...
...
This diff is collapsed.
Click to expand it.
lib/libwebsockets.h
+
3
−
0
View file @
ba119e90
...
@@ -1673,6 +1673,9 @@ lws_client_connect_extended(struct lws_context *clients, const char *address,
...
@@ -1673,6 +1673,9 @@ lws_client_connect_extended(struct lws_context *clients, const char *address,
LWS_VISIBLE
LWS_EXTERN
struct
lws
*
LWS_WARN_UNUSED_RESULT
LWS_VISIBLE
LWS_EXTERN
struct
lws
*
LWS_WARN_UNUSED_RESULT
lws_client_connect_via_info
(
struct
lws_client_connect_info
*
ccinfo
);
lws_client_connect_via_info
(
struct
lws_client_connect_info
*
ccinfo
);
LWS_VISIBLE
LWS_EXTERN
struct
lws
*
lws_adopt_socket
(
struct
lws_context
*
context
,
lws_sockfd_type
accept_fd
);
LWS_VISIBLE
LWS_EXTERN
const
char
*
LWS_WARN_UNUSED_RESULT
LWS_VISIBLE
LWS_EXTERN
const
char
*
LWS_WARN_UNUSED_RESULT
lws_canonical_hostname
(
struct
lws_context
*
context
);
lws_canonical_hostname
(
struct
lws_context
*
context
);
...
...
This diff is collapsed.
Click to expand it.
lib/server.c
+
10
−
3
View file @
ba119e90
...
@@ -702,9 +702,16 @@ lws_http_transaction_completed(struct lws *wsi)
...
@@ -702,9 +702,16 @@ lws_http_transaction_completed(struct lws *wsi)
return
0
;
return
0
;
}
}
/*
/**
* either returns new wsi bound to accept_fd, or closes accept_fd and
* lws_adopt_socket() - adopt foreign socket as if listen socket accepted it
* returns NULL, having cleaned up any new wsi pieces
* @context: lws context
* @accept_fd: fd of already-accepted socket to adopt
*
* Either returns new wsi bound to accept_fd, or closes accept_fd and
* returns NULL, having cleaned up any new wsi pieces.
*
* LWS adopts the socket in http serving mode, it's ready to accept an upgrade
* to ws or just serve http.
*/
*/
LWS_VISIBLE
struct
lws
*
LWS_VISIBLE
struct
lws
*
...
...
This diff is collapsed.
Click to expand it.
libwebsockets-api-doc.html
+
542
−
353
View file @
ba119e90
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