Merge pull request #2274 from esdrubal/udpclientreceive
[mono.git] / mcs / class / System / System.Net.Sockets / SafeSocketHandle.cs
index 9c9d8d751280f29fb9e163b4ffdc332051ff0863..e0f8569969f680c662d71a55e2019a5650015656 100644 (file)
@@ -32,29 +32,15 @@ namespace System.Net.Sockets {
                {
                }
 
-               bool closii;
-
-               /*protected override void Dispose (bool disposing)
-               {
-                       lock (this) {
-                               if (!closii) {
-
-                                       closii = true;
-                                       int error = 0;
-                                       Socket.Blocking_internal (handle, false, out error);
-                                       //AbortRegisteredThreads ();
-                                       Socket.Close_internal (handle, out error);
-                                       //Console.Error.WriteLine ("Closed "+ handle);
-                               }
-                       }
-                       base.Dispose (disposing);
-               }*/
-
                protected override bool ReleaseHandle ()
                {
                        int error = 0;
 
                        Socket.Blocking_internal (handle, false, out error);
+#if MOBILE_STATIC
+                       /* It's only for platforms that do not have working syscall abort mechanism, like WatchOS and TvOS */
+                       Socket.Shutdown_internal (handle, SocketShutdown.Both, out error);
+#endif
 
                        if (blocking_threads != null) {
                                int abort_attempts = 0;