Full posix sockets linux fixes#2
Closed
jakogut wants to merge 14 commits intojuj:full_posix_socketsfrom
Closed
Conversation
…ing the calls out to a sockets proxy bridge via WebSockets
juj
reviewed
Jun 9, 2019
| Emscripten provides a native POSIX Sockets proxy server program, located in directory tools/websocket_to_posix_proxy/, that allows full POSIX Sockets API access from a web browser. This support works by proxying all POSIX Sockets API calls from the browser to the Emscripten POSIX Sockets proxy server (via transparent use of WebSockets API), and the proxy server then performs the native TCP/UDP calls on behalf of the page. This allows a web browser page to run full TCP & UDP connections, act as a server to accept incoming connections, and perform host name lookups and reverse lookups. Because all API calls are individually proxied, this support can be slow. This support is mostly useful for developing testing infrastructure and debugging. | ||
|
|
||
| To use POSIX sockets proxying, link the application with flags "-lwebsocket.js -s PROXY_POSIX_SOCKETS=1 -s USE_PTHREADS=1 -s PROXY_TO_PTHREAD=1". That is, POSIX sockets proxying builds on top of the Emscripten WebSockets library, and requires multithreading and proxying the application main() to a pthread. | ||
| To use POSIX sockets proxying, link the application with flags "-lwebsocket.js -s PROXY_POSIX_SOCKETS=1 -s USE_PTHREADS=1 -s PROXY_TO_PTHREAD=1 -s FORCE_FILESYSTEM=1". That is, POSIX sockets proxying builds on top of the Emscripten WebSockets library, and requires multithreading and proxying the application main() to a pthread. Without FORCE_FILESYSTEM=1, required syscalls may be optimized out, giving the runtime error "SYSCALLS.getStreamFromFD is not a function". |
Owner
There was a problem hiding this comment.
Hmm, it is not intended to use -s FORCE_FILESYSTEM=1 with sockets proxying - any code in the SYSCALLS.* will not be compatible with sockets proxying, but rather if you are getting such an error, I think it's due to some bits missing in the sockets proxying PR. Let's revert this doc piece back and look at the runtime error in more detail?
juj
reviewed
Jun 9, 2019
| #include <errno.h> | ||
| #include <assert.h> | ||
| #include <netdb.h> | ||
| #include <arpa/inet.h> |
Owner
There was a problem hiding this comment.
Let's put this behind #if defined(__APPLE__) || defined(__linux__)
juj
reviewed
Jun 9, 2019
| return val.s_addr; | ||
| return INADDR_NONE; | ||
| } | ||
|
|
Owner
There was a problem hiding this comment.
This looks odd, why implement inet_addr here? It looks like it is provided by sockets library, declared in that <arpa/inet.h>
juj
reviewed
Jun 9, 2019
| with PythonTcpEchoServerProcess('7777'): | ||
| # Build and run the TCP echo client program with Emscripten | ||
| self.btest(path_from_root('tests', 'websocket', 'tcp_echo_client.cpp'), expected='101', args=['-lwebsocket', '-s', 'PROXY_POSIX_SOCKETS=1', '-s', 'USE_PTHREADS=1', '-s', 'PROXY_TO_PTHREAD=1']) | ||
| self.btest(path_from_root('tests', 'websocket', 'tcp_echo_client.cpp'), expected='101', args=['-lwebsocket', '-s', 'PROXY_POSIX_SOCKETS=1', '-s', 'USE_PTHREADS=1', '-s', 'PROXY_TO_PTHREAD=1', '-s', 'FORCE_FILESYSTEM=1']) |
juj
reviewed
Jun 9, 2019
| add_executable(websocket_to_posix_proxy ${sourceFiles}) | ||
|
|
||
| find_package(Threads) | ||
| target_link_libraries(websocket_to_posix_proxy ${CMAKE_THREAD_LIBS_INIT}) |
juj
reviewed
Jun 9, 2019
| #if defined(__APPLE__) || defined(__linux__) | ||
|
|
||
| #include <sys/socket.h> | ||
| #include <signal.h> |
7aa34e4 to
1d220c5
Compare
f52e26e to
aaee189
Compare
0761158 to
9ac2540
Compare
juj
pushed a commit
that referenced
this pull request
May 18, 2020
* Updated WebGPU
* Updated AUTHORS
* Updated WebGPU
* Updated AUTHORS
* Fixed review issues
- Changed 'const * nextInChain' to 'chain' for chained descriptors
- Removed unnecessary structs/enums for web
- Changed wgpuDeviceGetDefaultQueue so it returns the same queue
when called multiple times with the same device
- Changed makeCheckDescriptor to also work with 'chain' member (hacky)
* Fixed review #2 issues
* Updated shader module creation
* Fixed struct_info.json
* Shader module descriptor chaining
* Apply suggestions from code review
* Adapt to Dawn webgpu.h
* Remove some unused and deprecated bits
Co-authored-by: Kai Ninomiya <kainino@chromium.org>
Co-authored-by: Hugo Amiard <hugo.amiard@laposte.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes issues with missing headers and symbols when building websocket_to_posix_proxy on Linux.