Changed socket features.

This commit is contained in:
Christian
2018-04-28 13:05:35 +02:00
parent 357fd844d7
commit b9a73cc23d
3 changed files with 7 additions and 3 deletions
@@ -49,6 +49,7 @@ namespace MQTTnet.Implementations
{
_socket = new StreamSocket();
_socket.Control.NoDelay = true;
_socket.Control.KeepAlive = true;
}
if (!_options.TlsOptions.UseTls)
@@ -33,9 +33,12 @@ namespace MQTTnet.Implementations
// This also affects the client sockets.
_defaultEndpointSocket.Control.NoDelay = true;
_defaultEndpointSocket.Control.KeepAlive = true;
_defaultEndpointSocket.Control.QualityOfService = SocketQualityOfService.LowLatency;
_defaultEndpointSocket.ConnectionReceived += AcceptDefaultEndpointConnectionsAsync;
await _defaultEndpointSocket.BindServiceNameAsync(options.GetDefaultEndpointPort().ToString(), SocketProtectionLevel.PlainSocket);
_defaultEndpointSocket.ConnectionReceived += AcceptDefaultEndpointConnectionsAsync;
}
if (options.TlsEndpointOptions.IsEnabled)
@@ -59,7 +62,7 @@ namespace MQTTnet.Implementations
public void Dispose()
{
StopAsync();
StopAsync().GetAwaiter().GetResult();
}
private void AcceptDefaultEndpointConnectionsAsync(StreamSocketListener sender, StreamSocketListenerConnectionReceivedEventArgs args)
@@ -88,7 +88,7 @@ namespace MQTTnet.Implementations
public void Dispose()
{
StopAsync();
StopAsync().GetAwaiter().GetResult();
}
private async Task AcceptDefaultEndpointConnectionsAsync(CancellationToken cancellationToken)