Add StreamListenOptions.
Can be used to set the SO_REUSEPORT option for multi-thread/multi-process incoming TCP connection distribution.
This commit is contained in:
parent
3a5142baf0
commit
3d81854214
4 changed files with 36 additions and 8 deletions
|
@ -144,7 +144,11 @@ interface EventDriverSockets {
|
|||
StreamSocketFD adoptStream(int socket);
|
||||
|
||||
/// Creates a socket listening for incoming stream connections.
|
||||
StreamListenSocketFD listenStream(scope Address bind_address, AcceptCallback on_accept);
|
||||
StreamListenSocketFD listenStream(scope Address bind_address, StreamListenOptions options, AcceptCallback on_accept);
|
||||
|
||||
final StreamListenSocketFD listenStream(scope Address bind_address, AcceptCallback on_accept) {
|
||||
return listenStream(bind_address, StreamListenOptions.defaults, on_accept);
|
||||
}
|
||||
|
||||
/// Starts to wait for incoming connections on a listening socket.
|
||||
void waitForConnections(StreamListenSocketFD sock, AcceptCallback on_accept);
|
||||
|
@ -504,6 +508,11 @@ enum ConnectionState {
|
|||
closed
|
||||
}
|
||||
|
||||
enum StreamListenOptions {
|
||||
defaults = 0,
|
||||
reusePort = 1<<0,
|
||||
}
|
||||
|
||||
/**
|
||||
Specifies how a file is manipulated on disk.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue