2002-09-03 Dietmar Maurer <dietmar@ximian.com>
authorDietmar Maurer <dietmar@mono-cvs.ximian.com>
Thu, 5 Sep 2002 07:59:45 +0000 (07:59 -0000)
committerDietmar Maurer <dietmar@mono-cvs.ximian.com>
Thu, 5 Sep 2002 07:59:45 +0000 (07:59 -0000)
* System.Runtime.Remoting.Channels.CORBA/CORBAChannel.cs:
impl. the channel wrapper.

* System.Runtime.Remoting.Channels.Simple/SimpleChannel.cs:
impl. the channel wrapper.

* System.Runtime.Remoting.Channels.Simple/SimpleServerChannel.cs
(GetUrlsForUri): use all available channel uris.

svn path=/trunk/mcs/; revision=7259

mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleClientTransportSink.cs
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Simple/SimpleServerChannel.cs
mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs
mcs/class/corlib/System.Runtime.Remoting.Proxies/RemotingProxy.cs
mcs/class/corlib/System.Runtime.Remoting/ChangeLog
mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs
mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs
mcs/class/corlib/System/AppDomain.cs
mcs/class/corlib/System/MarshalByRefObject.cs

index d16a5b9a58f1aae779a62aa910d7b0ebeae6f32c..4f5cdee6b8d0fff56645adaec7785223a8a61a58 100644 (file)
@@ -22,6 +22,7 @@ namespace System.Runtime.Remoting.Channels.Simple
                int port;
                
                TcpClient tcpclient;
+               Stream network_stream;
                
                public SimpleClientTransportSink (string url)
                {
@@ -70,9 +71,11 @@ namespace System.Runtime.Remoting.Channels.Simple
                                            out Stream responseStream)
                {
                        // get a network stream
-                       tcpclient.Connect (host, port);
-                       Stream network_stream = tcpclient.GetStream ();
-
+                       if (network_stream == null) {
+                               tcpclient.Connect (host, port);
+                               network_stream = tcpclient.GetStream ();
+                       }
+       
                        // send the message
                        SimpleMessageFormat.SendMessageStream (network_stream, (MemoryStream)requestStream,
                                                               SimpleMessageFormat.MessageType.Request,
@@ -84,7 +87,7 @@ namespace System.Runtime.Remoting.Channels.Simple
                        MemoryStream mem_stream = SimpleMessageFormat.ReceiveMessageStream (network_stream, out msg_type, out uri);
 
                        // close the stream
-                       tcpclient.Close ();
+                       //tcpclient.Close ();
 
                        switch (msg_type) {
                        case SimpleMessageFormat.MessageType.Response:
index ec0a93413f7eecc4b3e813fa403db9e5a5d7d791..d5a6ad4d53075653f514215e9db12b83a2d26f7b 100644 (file)
@@ -132,12 +132,13 @@ namespace System.Runtime.Remoting.Channels.Simple
 
                void WaitForConnections ()
                {
+                       TcpClient client = listener.AcceptTcpClient ();
+                       Stream network_stream = client.GetStream ();
+
                        while (true) {
-                               TcpClient client = listener.AcceptTcpClient ();
 
-                               sink.InternalProcessMessage (client.GetStream ());
+                               sink.InternalProcessMessage (network_stream);
 
-                               client.Close ();
                        }
                }
                
index 16131866bc4174fc45a68cfd90820dc744746fef..944254b988efc8360c259510d51d36ad99e25e02 100644 (file)
@@ -8,6 +8,7 @@
 //
 
 using System;
+using System.Runtime.Remoting;
 using System.Runtime.Remoting.Messaging;
 using System.Runtime.CompilerServices;
 
@@ -22,19 +23,27 @@ namespace System.Runtime.Remoting.Proxies
        public abstract class RealProxy {
 
                Type class_to_proxy;
-
-               protected RealProxy () {
+               
+               protected RealProxy ()
+               {
                        throw new NotImplementedException ();
                }
 
-               protected RealProxy (Type classToProxy) {
+               protected RealProxy (Type classToProxy)
+               {
                        this.class_to_proxy = classToProxy;
                }
 
-               protected RealProxy (Type classToProxy, IntPtr stub, object stubData) {
+               protected RealProxy (Type classToProxy, IntPtr stub, object stubData)
+               {
                        throw new NotImplementedException ();
                }
 
+               public virtual ObjRef CreateObjRef (Type requestedType)
+               {
+                       throw new NotImplementedException ();
+               }
+               
                public abstract IMessage Invoke (IMessage msg);
 
                /* this is called from unmanaged code */
index 06eeb0dbae6d88488845243605797768668cf9e4..269f7467806c738edb3b1847fa8d07ab5c9159f2 100644 (file)
@@ -20,7 +20,6 @@ namespace System.Runtime.Remoting.Proxies
 
                IMessageSink sink;
                
-               
                public RemotingProxy (Type type, IMessageSink sink) : base (type)
                {
                        this.sink = sink;
index 91fa39c5969a4c848ca1afc0b5dc6e0b5462199e..5fd14c89c61c9dde0c52d32de85a44dd33d90e11 100755 (executable)
@@ -1,5 +1,8 @@
 2002-09-03  Dietmar Maurer  <dietmar@ximian.com>
 
+       * RemotingServices.cs: add an unique app_id string used to generate
+       unique object uris.
+
        * ObjRef.cs: added serialization support
 
 2002-08-31  Dietmar Maurer  <dietmar@ximian.com>
index 0eb5e11902825857570ad9b25afa8c9efe7b4006..0a217393e1589b42aa2596f92e3e50d993981bfe 100644 (file)
@@ -144,7 +144,7 @@ namespace System.Runtime.Remoting {
                                throw new RemotingException ("Cannot create channel sink");
 
                        RemotingProxy real_proxy = new RemotingProxy (type, sink);
-
+                       
                        return real_proxy.GetTransparentProxy ();
                }
 
index c4dc8afc07bbd85f9218b329c8ec8773d90bb121..4fdecb067c0716cc7811ed112f5cc99d5ed71815 100644 (file)
@@ -21,6 +21,16 @@ namespace System.Runtime.Remoting
 {
        public sealed class RemotingServices {
 
+               internal static string app_id;
+               
+               static RemotingServices ()
+               {
+                        app_id = "/" + Guid.NewGuid().ToString().Replace('-', '_') + "/";
+                        
+               }
+               
+               static int next_id = 1;
+               
                private RemotingServices () {}
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -88,6 +98,11 @@ namespace System.Runtime.Remoting
                        return svr.GetType ();
                }
 
+               public static string GetObjectUri (MarshalByRefObject obj)
+               {
+                       throw new NotImplementedException ();
+               }
+               
                static Hashtable uri_hash = new Hashtable ();
                
                private static void RegisterServerForUri (MarshalByRefObject obj, string uri)
@@ -107,6 +122,12 @@ namespace System.Runtime.Remoting
                
                static Mutex mtx = new Mutex ();
                
+               public static ObjRef Marshal (MarshalByRefObject obj)
+               {
+                       string uri = app_id + Environment.TickCount + "_" + next_id++;
+                       return Marshal (obj, uri, null);
+               }
+               
                public static ObjRef Marshal (MarshalByRefObject obj, string uri)
                {
                        return Marshal (obj, uri, null);
@@ -136,7 +157,8 @@ namespace System.Runtime.Remoting
                                        RegisterServerForUri (obj, uri);
                                }
                        
-                               res = obj.CreateObjRef (type);
+                               // res = obj.CreateObjRef (type);
+                               res = new ObjRef (obj, type);
                                res.URI = uri;
                                
                        } finally {
index 1dc498e42b160c30cd820e1dac390edd77828549..ce391137c8176f48b17e14163d62fd7a32599a9d 100755 (executable)
@@ -29,8 +29,8 @@ namespace System {
 
                // Evidence evidence;
 
-               private AppDomain () {}
-               
+               AppDomain () {}
+
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private extern AppDomainSetup getSetup ();
 
index 0a5506c5f7063392151421a73cbe771c2c239255..d09394b1429010ba883035cf46ee59af91288114 100644 (file)
@@ -16,7 +16,7 @@ namespace System {
 
                public virtual ObjRef CreateObjRef (Type type)
                {
-                       return new ObjRef (this, type);
+                       throw new NotImplementedException ();
                }
 
                public object GetLifetimeService ()