Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

us_socket_transfer #175

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

abrownsword
Copy link

Add new function us_socket_transfer by extracting existing code for handling accepted sockets, and calling it from its former location. The new function can now be used to hand off a newly connected socket from outside the framework into the framework.

…andling accepted sockets, and calling it from its former location. The new function can now be used to hand off a newly connected socket from outside the framework into the framework.
…andling accepted sockets, and calling it from its former location. The new function can now be used to hand off a newly connected socket from outside the framework into the framework.
…ownsword/uSockets into add-transfer-descriptor-func

# Conflicts:
#	src/libusockets.h
@Jarred-Sumner
Copy link

I might use this too

@ghost
Copy link

ghost commented Apr 11, 2022

The idea is more to use a common event loop across all libraries you use, than to manually deal with FD. For instance if you do Asio there is a compilation flag for using Asio under uSockets

@abrownsword
Copy link
Author

Yes, but sometimes you are just going to have a file descriptor you want that common event loop to use. The OS and most other code deals in file descriptors, so there ought to be a way to introduce an externally created descriptor to enable interop with uWS. In my case I needed to send an accepted socket from another process, but there may be other such use cases.

@uNetworkingAB
Copy link
Contributor

This is going to get merged from Bun (where you also have attach/release) in a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants