Share port support (#253)

* Share port support
This commit is contained in:
Igor Demyanov 2019-12-04 11:35:02 +03:00 committed by Sigurd Meldgaard
parent caa1a31bb8
commit ae17e712e4
1 changed files with 9 additions and 3 deletions

View File

@ -88,18 +88,24 @@ class Server {
{dynamic address,
int port,
ServerTlsCredentials security,
ServerSettings http2ServerSettings}) async {
ServerSettings http2ServerSettings,
int backlog: 0,
bool v6Only: false,
bool shared: false}) async {
// TODO(dart-lang/grpc-dart#9): Handle HTTP/1.1 upgrade to h2c, if allowed.
Stream<Socket> server;
if (security != null) {
_secureServer = await SecureServerSocket.bind(
address ?? InternetAddress.anyIPv4,
port ?? 443,
security.securityContext);
security.securityContext,
backlog: backlog,
shared: shared,
v6Only: v6Only);
server = _secureServer;
} else {
_insecureServer = await ServerSocket.bind(
address ?? InternetAddress.anyIPv4, port ?? 80);
address ?? InternetAddress.anyIPv4, port ?? 80, backlog: backlog, shared: shared , v6Only: v6Only);
server = _insecureServer;
}
server.listen((socket) {