Closed kanak closed 3 years ago
Hi @mattgodbolt , please let me know if the changes look good to you and if you'd like further edits.
I need this change to move my application on to seasocks; my websocket commands often result in intensive computation and the easiest way to move things over without rearchitecting everything was to just run N threads per process and let each thread do blocking work if necessary.
Merging #146 (6db2169) into master (5cc8f38) will decrease coverage by
0.00%
. The diff coverage is50.00%
.
@@ Coverage Diff @@
## master #146 +/- ##
==========================================
- Coverage 38.71% 38.70% -0.01%
==========================================
Files 52 52
Lines 2379 2382 +3
==========================================
+ Hits 921 922 +1
- Misses 1458 1460 +2
Impacted Files | Coverage Δ | |
---|---|---|
src/main/c/Server.cpp | 29.64% <50.00%> (+0.03%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 5cc8f38...6db2169. Read the comment docs.
Sorry for the late response. Since SO_REUSEADDR
is already set, I don't see any drawbacks.
@kanak / @mattgodbolt: Does it make sense to set this via option instead of unconditionally?
Thansk both! Sorry I didn't spot this earlier. I've since fixed up my email filters so I should spot things in future!
Sorry for the late response. Since
SO_REUSEADDR
is already set, I don't see any drawbacks.@kanak / @mattgodbolt: Does it make sense to set this via option instead of unconditionally?
Hi @offa,
I think a flag just for SO_REUSEPORT
might not be a good idea, because SO_REUSEADDR
by itself on Linux has some annoying limitations ( https://stackoverflow.com/a/14388707) and SO_REUSEPORT
has some nice performance implications ( https://lwn.net/Articles/542629/ ).
However, a flag to disable both REUSE
flags altogether might be a good idea? That way you could be sure that there is no other thread/process on the same host that is also listening on the same port.
I see, so we can add such a flag later (if even necessary).
Agreed we can add flags for either or both later if needed. Thanks!
This allows us to have multiple threads listening on the same port in Linux. Also add an example demonstrating usage.