Merge pull request #2542 from akoeplinger/remove-changelog
[mono.git] / mcs / class / System.Runtime.Remoting / System.Runtime.Remoting.Channels.Tcp / TcpClientTransportSink.cs
index ddd08e6a8bf598f65b511a84818abb9b2a122e10..df0f08501bddd3c8a13dacc27262484deb372c26 100644 (file)
@@ -45,7 +45,19 @@ namespace System.Runtime.Remoting.Channels.Tcp
                public TcpClientTransportSink (string url)
                {
                        string objectUri;
-                       _host = TcpChannel.ParseTcpURL (url, out objectUri, out _port);
+                       string port;
+                       
+                       TcpChannel.ParseTcpURL (url, out _host, out port, out objectUri);
+                       
+                       try {
+                               if (port != null)
+                                       _port = Convert.ToInt32 (port);
+                               else
+                                       _port = 0;
+                       } catch {
+                               _host = null;
+                               _port = -1;
+                       }
                }
 
                public IDictionary Properties
@@ -81,13 +93,17 @@ namespace System.Runtime.Remoting.Channels.Tcp
                                // response of the server
 
                                connection = TcpConnectionPool.GetConnection (_host, _port);
-                               TcpMessageIO.SendMessageStream (connection.Stream, requestStream, headers, connection.Buffer);
+                               TcpMessageIO.SendMessageStream (connection.Stream, requestStream, headers, connection.Buffer, isOneWay);
                                connection.Stream.Flush ();
 
                                if (!isOneWay) 
                                {
                                        sinkStack.Push (this, connection);
-                                       ThreadPool.QueueUserWorkItem (new WaitCallback(ReadAsyncTcpMessage), sinkStack);
+                                       ThreadPool.QueueUserWorkItem (new WaitCallback(data => {
+                                               try {
+                                                       ReadAsyncTcpMessage (data);
+                                               } catch {}
+                                               }), sinkStack);
                                }
                                else
                                        connection.Release();