Merge pull request #3587 from henricm/fix-set-no-delay-tcp-only
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Wed, 21 Sep 2016 09:37:08 +0000 (11:37 +0200)
committerGitHub <noreply@github.com>
Wed, 21 Sep 2016 09:37:08 +0000 (11:37 +0200)
Only set NoDelay by default for protocol TCP

mcs/class/System/System.Net.Sockets/Socket.cs

index 396b16f4c5416c06b77b6666e47c6404ea198e26..58d0899bf13325c69fe70745178f944d0750e54f 100644 (file)
@@ -230,7 +230,8 @@ namespace System.Net.Sockets
                                         * effects on Linux, as the socket option is kludged by
                                         * turning on or off PMTU discovery... */
                                        this.DontFragment = false;
-                                       this.NoDelay = false;
+                                       if (protocol_type == ProtocolType.Tcp)
+                                               this.NoDelay = false;
                                } else if (address_family == AddressFamily.InterNetworkV6) {
                                        this.DualMode = true;
                                }
@@ -622,7 +623,6 @@ namespace System.Net.Sockets
                        set {
                                ThrowIfDisposedAndClosed ();
                                ThrowIfUdp ();
-
                                SetSocketOption (SocketOptionLevel.Tcp, SocketOptionName.NoDelay, value ? 1 : 0);
                        }
                }