Browse Source

Fix wrong NoDelay usage in server implementation.

release/3.x.x
Christian Kratky 5 years ago
parent
commit
4eb2b77138
2 changed files with 4 additions and 1 deletions
  1. +1
    -0
      Build/MQTTnet.nuspec
  2. +3
    -1
      Source/MQTTnet/Implementations/MqttTcpServerListener.cs

+ 1
- 0
Build/MQTTnet.nuspec View File

@@ -14,6 +14,7 @@
* [Server] Added items dictionary to client session in order to share data across interceptors as along as the session exists. * [Server] Added items dictionary to client session in order to share data across interceptors as along as the session exists.
* [Server] Exposed CONNECT packet properties in Application Message and Subscription interceptor. * [Server] Exposed CONNECT packet properties in Application Message and Subscription interceptor.
* [Server] Fixed: Sending Large packets with AspnetCore based connection throws System.ArgumentException. * [Server] Fixed: Sending Large packets with AspnetCore based connection throws System.ArgumentException.
* [Server] Fixed wrong usage of socket option _NoDelay_.
* [MQTTnet.Server] Added REST API for publishing basic messages. * [MQTTnet.Server] Added REST API for publishing basic messages.
</releaseNotes> </releaseNotes>
<copyright>Copyright Christian Kratky 2016-2019</copyright> <copyright>Copyright Christian Kratky 2016-2019</copyright>


+ 3
- 1
Source/MQTTnet/Implementations/MqttTcpServerListener.cs View File

@@ -61,6 +61,8 @@ namespace MQTTnet.Implementations


_socket = new Socket(_addressFamily, SocketType.Stream, ProtocolType.Tcp); _socket = new Socket(_addressFamily, SocketType.Stream, ProtocolType.Tcp);


// Usage of socket options is described here: https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.setsocketoption?view=netcore-2.2

if (_options.ReuseAddress) if (_options.ReuseAddress)
{ {
_socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); _socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
@@ -68,7 +70,7 @@ namespace MQTTnet.Implementations
if (_options.NoDelay) if (_options.NoDelay)
{ {
_socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.NoDelay, true);
_socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true);
} }
_socket.Bind(_localEndPoint); _socket.Bind(_localEndPoint);


Loading…
Cancel
Save