diff options
95 files changed, 6859 insertions, 6882 deletions
diff --git a/cs/INSTALL.WINDOWS b/cs/INSTALL.VISUAL_C# index 92a4c33f0b5..92a4c33f0b5 100644 --- a/cs/INSTALL.WINDOWS +++ b/cs/INSTALL.VISUAL_C# diff --git a/cs/config/TestUtil.py b/cs/config/TestUtil.py index 891d76a5889..3f8dfde2538 100644 --- a/cs/config/TestUtil.py +++ b/cs/config/TestUtil.py @@ -200,7 +200,7 @@ def createMsg(mono, name): def createCmd(mono, bin): if mono: - return "mono " + bin + ".exe" + return "mono --debug " + bin + ".exe" else: return bin diff --git a/cs/demo/Ice/callback/CallbackClient.cs b/cs/demo/Ice/callback/CallbackClient.cs index b230d49c7bb..700ccb1e33c 100755 --- a/cs/demo/Ice/callback/CallbackClient.cs +++ b/cs/demo/Ice/callback/CallbackClient.cs @@ -7,159 +7,159 @@ // // ********************************************************************** -
-using System;
-
-class CallbackClient : Ice.Application
-{
- private static void menu()
- {
- Console.Out.WriteLine("usage:\n"
- + "t: send callback as twoway\n"
- + "o: send callback as oneway\n"
- + "O: send callback as batch oneway\n"
- + "d: send callback as datagram\n"
- + "D: send callback as batch datagram\n"
- + "f: flush all batch requests\n"
- + "v: set/reset override context field\n"
- + "s: shutdown server\n"
- + "x: exit\n"
- + "?: help\n");
- }
-
- public override int run(string[] args)
- {
- Ice.Properties properties = communicator().getProperties();
- string proxyProperty = "Callback.Client.Callback";
- string proxy = properties.getProperty(proxyProperty);
- if(proxy.Length == 0)
- {
- Console.Error.WriteLine("property `" + proxyProperty + "' not set");
- return 1;
- }
-
- Ice.ObjectPrx @base = communicator().stringToProxy(proxy);
- CallbackPrx twoway = CallbackPrxHelper.checkedCast(@base.ice_twoway().ice_timeout(-1).ice_secure(false));
- if(twoway == null)
- {
- Console.Error.WriteLine("invalid proxy");
- return 1;
- }
- CallbackPrx oneway = CallbackPrxHelper.uncheckedCast(twoway.ice_oneway());
- CallbackPrx batchOneway = CallbackPrxHelper.uncheckedCast(twoway.ice_batchOneway());
- CallbackPrx datagram = CallbackPrxHelper.uncheckedCast(twoway.ice_datagram());
- CallbackPrx batchDatagram = CallbackPrxHelper.uncheckedCast(twoway.ice_batchDatagram());
-
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Client");
- adapter.add(new CallbackReceiverI(), Ice.Util.stringToIdentity("callbackReceiver"));
- adapter.activate();
-
- CallbackReceiverPrx twowayR = CallbackReceiverPrxHelper.uncheckedCast(
- adapter.createProxy(Ice.Util.stringToIdentity("callbackReceiver")));
- CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(
- twowayR.ice_oneway());
- //CallbackReceiverPrx batchOnewayR =
- // CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_batchOneway());
- CallbackReceiverPrx datagramR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_datagram());
- //CallbackReceiverPrx batchDatagramR =
- // CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_batchDatagram());
-
- string overwrite = null;
-
- menu();
-
- string line = null;
- do
- {
- try
- {
- Console.Out.Write("==> ");
- Console.Out.Flush();
- line = Console.In.ReadLine();
- if(line == null)
- {
- break;
- }
- if(line.Equals("t"))
- {
- Ice.Context context = new Ice.Context();
- context["_fwd"] = "t";
- twoway.initiateCallback(twowayR, context);
- }
- else if(line.Equals("o"))
- {
- Ice.Context context = new Ice.Context();
- context["_fwd"] = "o";
- oneway.initiateCallback(onewayR, context);
- }
- else if(line.Equals("O"))
- {
- Ice.Context context = new Ice.Context();
- context["_fwd"] = "O";
- if(overwrite != null)
- {
- context["_ovwt"] = overwrite;
- }
- batchOneway.initiateCallback(onewayR, context);
- }
- else if(line.Equals("d"))
- {
- Ice.Context context = new Ice.Context();
- context["_fwd"] = "d";
- datagram.initiateCallback(datagramR, context);
- }
- else if(line.Equals("D"))
- {
- Ice.Context context = new Ice.Context();
- context["_fwd"] = "D";
- if(overwrite != null)
- {
- context["_ovwt"] = overwrite;
- }
- batchDatagram.initiateCallback(datagramR, context);
- }
- else if(line.Equals("f"))
- {
- communicator().flushBatchRequests();
- }
- else if(line.Equals("v"))
- {
- if(overwrite == null)
- {
- overwrite = "some_value";
- Console.Out.WriteLine("overwrite context field is now `" + overwrite + "'");
- }
- else
- {
- overwrite = null;
- Console.Out.WriteLine("overwrite context field is empty");
- }
- }
- else if(line.Equals("s"))
- {
- twoway.shutdown();
- }
- else if(line.Equals("x"))
- {
- // Nothing to do
- }
- else if(line.Equals("?"))
- {
- menu();
- }
- else
- {
- Console.Out.WriteLine("unknown command `" + line + "'");
- menu();
- }
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- }
- }
- while(!line.Equals("x"));
-
- return 0;
- }
-}
+ +using System; + +class CallbackClient : Ice.Application +{ + private static void menu() + { + Console.Out.WriteLine("usage:\n" + + "t: send callback as twoway\n" + + "o: send callback as oneway\n" + + "O: send callback as batch oneway\n" + + "d: send callback as datagram\n" + + "D: send callback as batch datagram\n" + + "f: flush all batch requests\n" + + "v: set/reset override context field\n" + + "s: shutdown server\n" + + "x: exit\n" + + "?: help\n"); + } + + public override int run(string[] args) + { + Ice.Properties properties = communicator().getProperties(); + string proxyProperty = "Callback.Client.Callback"; + string proxy = properties.getProperty(proxyProperty); + if(proxy.Length == 0) + { + Console.Error.WriteLine("property `" + proxyProperty + "' not set"); + return 1; + } + + Ice.ObjectPrx @base = communicator().stringToProxy(proxy); + CallbackPrx twoway = CallbackPrxHelper.checkedCast(@base.ice_twoway().ice_timeout(-1).ice_secure(false)); + if(twoway == null) + { + Console.Error.WriteLine("invalid proxy"); + return 1; + } + CallbackPrx oneway = CallbackPrxHelper.uncheckedCast(twoway.ice_oneway()); + CallbackPrx batchOneway = CallbackPrxHelper.uncheckedCast(twoway.ice_batchOneway()); + CallbackPrx datagram = CallbackPrxHelper.uncheckedCast(twoway.ice_datagram()); + CallbackPrx batchDatagram = CallbackPrxHelper.uncheckedCast(twoway.ice_batchDatagram()); + + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Client"); + adapter.add(new CallbackReceiverI(), Ice.Util.stringToIdentity("callbackReceiver")); + adapter.activate(); + + CallbackReceiverPrx twowayR = CallbackReceiverPrxHelper.uncheckedCast( + adapter.createProxy(Ice.Util.stringToIdentity("callbackReceiver"))); + CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast( + twowayR.ice_oneway()); + //CallbackReceiverPrx batchOnewayR = + // CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_batchOneway()); + CallbackReceiverPrx datagramR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_datagram()); + //CallbackReceiverPrx batchDatagramR = + // CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_batchDatagram()); + + string overwrite = null; + + menu(); + + string line = null; + do + { + try + { + Console.Out.Write("==> "); + Console.Out.Flush(); + line = Console.In.ReadLine(); + if(line == null) + { + break; + } + if(line.Equals("t")) + { + Ice.Context context = new Ice.Context(); + context["_fwd"] = "t"; + twoway.initiateCallback(twowayR, context); + } + else if(line.Equals("o")) + { + Ice.Context context = new Ice.Context(); + context["_fwd"] = "o"; + oneway.initiateCallback(onewayR, context); + } + else if(line.Equals("O")) + { + Ice.Context context = new Ice.Context(); + context["_fwd"] = "O"; + if(overwrite != null) + { + context["_ovwt"] = overwrite; + } + batchOneway.initiateCallback(onewayR, context); + } + else if(line.Equals("d")) + { + Ice.Context context = new Ice.Context(); + context["_fwd"] = "d"; + datagram.initiateCallback(datagramR, context); + } + else if(line.Equals("D")) + { + Ice.Context context = new Ice.Context(); + context["_fwd"] = "D"; + if(overwrite != null) + { + context["_ovwt"] = overwrite; + } + batchDatagram.initiateCallback(datagramR, context); + } + else if(line.Equals("f")) + { + communicator().flushBatchRequests(); + } + else if(line.Equals("v")) + { + if(overwrite == null) + { + overwrite = "some_value"; + Console.Out.WriteLine("overwrite context field is now `" + overwrite + "'"); + } + else + { + overwrite = null; + Console.Out.WriteLine("overwrite context field is empty"); + } + } + else if(line.Equals("s")) + { + twoway.shutdown(); + } + else if(line.Equals("x")) + { + // Nothing to do + } + else if(line.Equals("?")) + { + menu(); + } + else + { + Console.Out.WriteLine("unknown command `" + line + "'"); + menu(); + } + } + catch(System.Exception ex) + { + Console.Error.WriteLine(ex); + } + } + while(!line.Equals("x")); + + return 0; + } +} diff --git a/cs/demo/Ice/callback/CallbackI.cs b/cs/demo/Ice/callback/CallbackI.cs index 83eee4178e1..852df308000 100755 --- a/cs/demo/Ice/callback/CallbackI.cs +++ b/cs/demo/Ice/callback/CallbackI.cs @@ -7,18 +7,18 @@ // // ********************************************************************** -
-public sealed class CallbackI : Callback
-{
- public override void initiateCallback(CallbackReceiverPrx proxy, Ice.Current current)
- {
- System.Console.Out.WriteLine("initiating callback");
- proxy.callback(current.ctx);
- }
-
- public override void shutdown(Ice.Current current)
- {
- System.Console.Out.WriteLine("Shutting down...");
- current.adapter.getCommunicator().shutdown();
- }
-}
+ +public sealed class CallbackI : Callback +{ + public override void initiateCallback(CallbackReceiverPrx proxy, Ice.Current current) + { + System.Console.Out.WriteLine("initiating callback"); + proxy.callback(current.ctx); + } + + public override void shutdown(Ice.Current current) + { + System.Console.Out.WriteLine("Shutting down..."); + current.adapter.getCommunicator().shutdown(); + } +} diff --git a/cs/demo/Ice/callback/CallbackReceiverI.cs b/cs/demo/Ice/callback/CallbackReceiverI.cs index d73f34f8b83..8390b7348c6 100755 --- a/cs/demo/Ice/callback/CallbackReceiverI.cs +++ b/cs/demo/Ice/callback/CallbackReceiverI.cs @@ -7,11 +7,11 @@ // // ********************************************************************** -
-public sealed class CallbackReceiverI : CallbackReceiver
-{
- public override void callback(Ice.Current current)
- {
- System.Console.Out.WriteLine("received callback");
- }
-}
+ +public sealed class CallbackReceiverI : CallbackReceiver +{ + public override void callback(Ice.Current current) + { + System.Console.Out.WriteLine("received callback"); + } +} diff --git a/cs/demo/Ice/callback/CallbackServer.cs b/cs/demo/Ice/callback/CallbackServer.cs index d8ceb8b13bd..206ee96cdac 100755 --- a/cs/demo/Ice/callback/CallbackServer.cs +++ b/cs/demo/Ice/callback/CallbackServer.cs @@ -7,16 +7,16 @@ // // ********************************************************************** -
-class CallbackServer : Ice.Application
-{
- public override int run(string[] args)
- {
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Server");
- CallbackPrx self = CallbackPrxHelper.uncheckedCast(adapter.createProxy(Ice.Util.stringToIdentity("callback")));
- adapter.add(new CallbackI(), Ice.Util.stringToIdentity("callback"));
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
- }
-}
+ +class CallbackServer : Ice.Application +{ + public override int run(string[] args) + { + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Server"); + CallbackPrx self = CallbackPrxHelper.uncheckedCast(adapter.createProxy(Ice.Util.stringToIdentity("callback"))); + adapter.add(new CallbackI(), Ice.Util.stringToIdentity("callback")); + adapter.activate(); + communicator().waitForShutdown(); + return 0; + } +} diff --git a/cs/demo/Ice/callback/Client.cs b/cs/demo/Ice/callback/Client.cs index db681344c75..f06d379fef2 100755 --- a/cs/demo/Ice/callback/Client.cs +++ b/cs/demo/Ice/callback/Client.cs @@ -7,13 +7,13 @@ // // ********************************************************************** -
-public class Client
-{
- public static void Main(string[] args)
- {
- CallbackClient app = new CallbackClient();
- int status = app.main(args, "config");
- System.Environment.Exit(status);
- }
-}
+ +public class Client +{ + public static void Main(string[] args) + { + CallbackClient app = new CallbackClient(); + int status = app.main(args, "config"); + System.Environment.Exit(status); + } +} diff --git a/cs/demo/Ice/callback/Server.cs b/cs/demo/Ice/callback/Server.cs index ae9406bc2d3..5325d11bcde 100755 --- a/cs/demo/Ice/callback/Server.cs +++ b/cs/demo/Ice/callback/Server.cs @@ -7,13 +7,13 @@ // // ********************************************************************** -
-public class Server
-{
- public static void Main(string[] args)
- {
- CallbackServer app = new CallbackServer();
- int status = app.main(args, "config.server");
- System.Environment.Exit(status);
- }
-}
+ +public class Server +{ + public static void Main(string[] args) + { + CallbackServer app = new CallbackServer(); + int status = app.main(args, "config.server"); + System.Environment.Exit(status); + } +} diff --git a/cs/demo/Ice/hello/Client.cs b/cs/demo/Ice/hello/Client.cs index 0ec655877ba..d61e1b7c729 100755 --- a/cs/demo/Ice/hello/Client.cs +++ b/cs/demo/Ice/hello/Client.cs @@ -7,167 +7,167 @@ // // ********************************************************************** -
-using System;
-
-public class Client
-{
- private static void menu()
- {
- Console.WriteLine(
- "usage:\n" +
- "t: send greeting as twoway\n" +
- "o: send greeting as oneway\n" +
- "O: send greeting as batch oneway\n" +
- "d: send greeting as datagram\n" +
- "D: send greeting as batch datagram\n" +
- "f: flush all batch requests\n" +
- "T: set a timeout\n" +
- "s: shutdown server\n" +
- "x: exit\n" +
- "?: help\n");
- }
-
- private static int run(string[] args, Ice.Communicator communicator)
- {
- Ice.Properties properties = communicator.getProperties();
- string proxyProperty = "Hello.Proxy";
- string proxy = properties.getProperty(proxyProperty);
- if(proxy.Length == 0)
- {
- Console.Error.WriteLine("property `" + proxyProperty + "' not set");
- return 1;
- }
-
- Ice.ObjectPrx basePrx = communicator.stringToProxy(proxy);
- HelloPrx twoway = HelloPrxHelper.checkedCast(basePrx.ice_twoway().ice_timeout(-1).ice_secure(false));
- if(twoway == null)
- {
- Console.Error.WriteLine("invalid proxy");
- return 1;
- }
- HelloPrx oneway = HelloPrxHelper.uncheckedCast(twoway.ice_oneway());
- HelloPrx batchOneway = HelloPrxHelper.uncheckedCast(twoway.ice_batchOneway());
- HelloPrx datagram = HelloPrxHelper.uncheckedCast(twoway.ice_datagram());
- HelloPrx batchDatagram = HelloPrxHelper.uncheckedCast(twoway.ice_batchDatagram());
-
- int timeout = -1;
-
- menu();
-
- string line = null;
- do
- {
- try
- {
- Console.Out.Write("==> ");
- Console.Out.Flush();
- line = Console.In.ReadLine();
- if(line == null)
- {
- break;
- }
- if(line.Equals("t"))
- {
- twoway.sayHello();
- }
- else if(line.Equals("o"))
- {
- oneway.sayHello();
- }
- else if(line.Equals("O"))
- {
- batchOneway.sayHello();
- }
- else if(line.Equals("d"))
- {
- datagram.sayHello();
- }
- else if(line.Equals("D"))
- {
- batchDatagram.sayHello();
- }
- else if(line.Equals("f"))
- {
- communicator.flushBatchRequests();
- }
- else if(line.Equals("T"))
- {
- if(timeout == -1)
- {
- timeout = 2000;
- }
- else
- {
- timeout = -1;
- }
-
- twoway = HelloPrxHelper.uncheckedCast(twoway.ice_timeout(timeout));
- oneway = HelloPrxHelper.uncheckedCast(oneway.ice_timeout(timeout));
- batchOneway = HelloPrxHelper.uncheckedCast(batchOneway.ice_timeout(timeout));
-
- if(timeout == -1)
- {
- Console.WriteLine("timeout is now switched off");
- }
- else
- {
- Console.WriteLine("timeout is now set to 2000ms");
- }
- }
- else if(line.Equals("s"))
- {
- twoway.shutdown();
- }
- else if(line.Equals("x"))
- {
- // Nothing to do
- }
- else if(line.Equals("?"))
- {
- menu();
- }
- else
- {
- Console.WriteLine("unknown command `" + line + "'");
- menu();
- }
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- }
- }
- while (!line.Equals("x"));
-
- return 0;
- }
-
- public static void Main(string[] args)
- {
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.Properties properties = Ice.Util.createProperties(ref args);
- properties.load("config");
- communicator = Ice.Util.initializeWithProperties(ref args, properties);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- finally
- {
- if(communicator != null)
- {
- communicator.destroy();
- }
- }
-
- System.Environment.Exit(status);
- }
-}
+ +using System; + +public class Client +{ + private static void menu() + { + Console.WriteLine( + "usage:\n" + + "t: send greeting as twoway\n" + + "o: send greeting as oneway\n" + + "O: send greeting as batch oneway\n" + + "d: send greeting as datagram\n" + + "D: send greeting as batch datagram\n" + + "f: flush all batch requests\n" + + "T: set a timeout\n" + + "s: shutdown server\n" + + "x: exit\n" + + "?: help\n"); + } + + private static int run(string[] args, Ice.Communicator communicator) + { + Ice.Properties properties = communicator.getProperties(); + string proxyProperty = "Hello.Proxy"; + string proxy = properties.getProperty(proxyProperty); + if(proxy.Length == 0) + { + Console.Error.WriteLine("property `" + proxyProperty + "' not set"); + return 1; + } + + Ice.ObjectPrx basePrx = communicator.stringToProxy(proxy); + HelloPrx twoway = HelloPrxHelper.checkedCast(basePrx.ice_twoway().ice_timeout(-1).ice_secure(false)); + if(twoway == null) + { + Console.Error.WriteLine("invalid proxy"); + return 1; + } + HelloPrx oneway = HelloPrxHelper.uncheckedCast(twoway.ice_oneway()); + HelloPrx batchOneway = HelloPrxHelper.uncheckedCast(twoway.ice_batchOneway()); + HelloPrx datagram = HelloPrxHelper.uncheckedCast(twoway.ice_datagram()); + HelloPrx batchDatagram = HelloPrxHelper.uncheckedCast(twoway.ice_batchDatagram()); + + int timeout = -1; + + menu(); + + string line = null; + do + { + try + { + Console.Out.Write("==> "); + Console.Out.Flush(); + line = Console.In.ReadLine(); + if(line == null) + { + break; + } + if(line.Equals("t")) + { + twoway.sayHello(); + } + else if(line.Equals("o")) + { + oneway.sayHello(); + } + else if(line.Equals("O")) + { + batchOneway.sayHello(); + } + else if(line.Equals("d")) + { + datagram.sayHello(); + } + else if(line.Equals("D")) + { + batchDatagram.sayHello(); + } + else if(line.Equals("f")) + { + communicator.flushBatchRequests(); + } + else if(line.Equals("T")) + { + if(timeout == -1) + { + timeout = 2000; + } + else + { + timeout = -1; + } + + twoway = HelloPrxHelper.uncheckedCast(twoway.ice_timeout(timeout)); + oneway = HelloPrxHelper.uncheckedCast(oneway.ice_timeout(timeout)); + batchOneway = HelloPrxHelper.uncheckedCast(batchOneway.ice_timeout(timeout)); + + if(timeout == -1) + { + Console.WriteLine("timeout is now switched off"); + } + else + { + Console.WriteLine("timeout is now set to 2000ms"); + } + } + else if(line.Equals("s")) + { + twoway.shutdown(); + } + else if(line.Equals("x")) + { + // Nothing to do + } + else if(line.Equals("?")) + { + menu(); + } + else + { + Console.WriteLine("unknown command `" + line + "'"); + menu(); + } + } + catch(System.Exception ex) + { + Console.Error.WriteLine(ex); + } + } + while (!line.Equals("x")); + + return 0; + } + + public static void Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + Ice.Properties properties = Ice.Util.createProperties(ref args); + properties.load("config"); + communicator = Ice.Util.initializeWithProperties(ref args, properties); + status = run(args, communicator); + } + catch(System.Exception ex) + { + Console.Error.WriteLine(ex); + status = 1; + } + finally + { + if(communicator != null) + { + communicator.destroy(); + } + } + + System.Environment.Exit(status); + } +} diff --git a/cs/demo/Ice/hello/HelloI.cs b/cs/demo/Ice/hello/HelloI.cs index e559a80beed..e5496e91b1c 100755 --- a/cs/demo/Ice/hello/HelloI.cs +++ b/cs/demo/Ice/hello/HelloI.cs @@ -7,17 +7,17 @@ // // ********************************************************************** -
-public class HelloI : Hello
-{
- public override void sayHello(Ice.Current current)
- {
- System.Console.Out.WriteLine("Hello World!");
- }
-
- public override void shutdown(Ice.Current current)
- {
- System.Console.Out.WriteLine("Shutting down...");
- current.adapter.getCommunicator().shutdown();
- }
-}
+ +public class HelloI : Hello +{ + public override void sayHello(Ice.Current current) + { + System.Console.Out.WriteLine("Hello World!"); + } + + public override void shutdown(Ice.Current current) + { + System.Console.Out.WriteLine("Shutting down..."); + current.adapter.getCommunicator().shutdown(); + } +} diff --git a/cs/demo/Ice/latency/Client.cs b/cs/demo/Ice/latency/Client.cs index 9152f222f8a..03740c29b40 100755 --- a/cs/demo/Ice/latency/Client.cs +++ b/cs/demo/Ice/latency/Client.cs @@ -7,76 +7,76 @@ // // ********************************************************************** -
-using System;
-
-public class Client
-{
- private static int run(string[] args, Ice.Communicator communicator)
- {
- Ice.Properties properties = communicator.getProperties();
- string refProperty = "Latency.Ping";
- string @ref = properties.getProperty(refProperty);
- if(@ref.Length == 0)
- {
- Console.Error.WriteLine("property `" + refProperty + "' not set");
- return 1;
- }
-
- Ice.ObjectPrx @base = communicator.stringToProxy(@ref);
- PingPrx ping = PingPrxHelper.checkedCast(@base);
- if(ping == null)
- {
- Console.Error.WriteLine("invalid proxy");
- return 1;
- }
-
- // Initial ping to setup the connection.
- ping.ice_ping();
-
- long tv1 = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
- int repetitions = 100000;
- Console.Out.WriteLine("pinging server " + repetitions + " times (this may take a while)");
- for (int i = 0; i < repetitions; i++)
- {
- ping.ice_ping();
- }
-
- long tv2 = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
- double total = (double)(tv2 - tv1);
- double perPing = total / repetitions;
-
- Console.Out.WriteLine("time for " + repetitions + " pings: " + total + "ms");
- Console.Out.WriteLine("time per ping: " + perPing + "ms");
-
- return 0;
- }
-
- public static void Main(string[] args)
- {
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.Properties properties = Ice.Util.createProperties(ref args);
- properties.load("config");
- communicator = Ice.Util.initializeWithProperties(ref args, properties);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- finally
- {
- if(communicator != null)
- {
- communicator.destroy();
- }
- }
-
- System.Environment.Exit(status);
- }
-}
+ +using System; + +public class Client +{ + private static int run(string[] args, Ice.Communicator communicator) + { + Ice.Properties properties = communicator.getProperties(); + string refProperty = "Latency.Ping"; + string @ref = properties.getProperty(refProperty); + if(@ref.Length == 0) + { + Console.Error.WriteLine("property `" + refProperty + "' not set"); + return 1; + } + + Ice.ObjectPrx @base = communicator.stringToProxy(@ref); + PingPrx ping = PingPrxHelper.checkedCast(@base); + if(ping == null) + { + Console.Error.WriteLine("invalid proxy"); + return 1; + } + + // Initial ping to setup the connection. + ping.ice_ping(); + + long tv1 = (System.DateTime.Now.Ticks - 621355968000000000) / 10000; + int repetitions = 100000; + Console.Out.WriteLine("pinging server " + repetitions + " times (this may take a while)"); + for (int i = 0; i < repetitions; i++) + { + ping.ice_ping(); + } + + long tv2 = (System.DateTime.Now.Ticks - 621355968000000000) / 10000; + double total = (double)(tv2 - tv1); + double perPing = total / repetitions; + + Console.Out.WriteLine("time for " + repetitions + " pings: " + total + "ms"); + Console.Out.WriteLine("time per ping: " + perPing + "ms"); + + return 0; + } + + public static void Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + Ice.Properties properties = Ice.Util.createProperties(ref args); + properties.load("config"); + communicator = Ice.Util.initializeWithProperties(ref args, properties); + status = run(args, communicator); + } + catch(System.Exception ex) + { + Console.Error.WriteLine(ex); + status = 1; + } + finally + { + if(communicator != null) + { + communicator.destroy(); + } + } + + System.Environment.Exit(status); + } +} diff --git a/cs/demo/Ice/latency/Server.cs b/cs/demo/Ice/latency/Server.cs index 439376093b2..03ba133f217 100755 --- a/cs/demo/Ice/latency/Server.cs +++ b/cs/demo/Ice/latency/Server.cs @@ -7,46 +7,46 @@ // // ********************************************************************** -
-using System;
-
-public class Server
-{
- private static int run(string[] args, Ice.Communicator communicator)
- {
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("Latency");
- Ice.Object @object = new Ping();
- adapter.add(@object, Ice.Util.stringToIdentity("ping"));
- adapter.activate();
- communicator.waitForShutdown();
- return 0;
- }
-
- public static void Main(string[] args)
- {
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.Properties properties = Ice.Util.createProperties(ref args);
- properties.load("config");
- communicator = Ice.Util.initializeWithProperties(ref args, properties);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- finally
- {
- if(communicator != null)
- {
- communicator.destroy();
- }
- }
-
- System.Environment.Exit(status);
- }
-}
+ +using System; + +public class Server +{ + private static int run(string[] args, Ice.Communicator communicator) + { + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("Latency"); + Ice.Object @object = new Ping(); + adapter.add(@object, Ice.Util.stringToIdentity("ping")); + adapter.activate(); + communicator.waitForShutdown(); + return 0; + } + + public static void Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + Ice.Properties properties = Ice.Util.createProperties(ref args); + properties.load("config"); + communicator = Ice.Util.initializeWithProperties(ref args, properties); + status = run(args, communicator); + } + catch(System.Exception ex) + { + Console.Error.WriteLine(ex); + status = 1; + } + finally + { + if(communicator != null) + { + communicator.destroy(); + } + } + + System.Environment.Exit(status); + } +} diff --git a/cs/demo/Ice/nested/Client.cs b/cs/demo/Ice/nested/Client.cs index e110144e698..990a640ae5f 100755 --- a/cs/demo/Ice/nested/Client.cs +++ b/cs/demo/Ice/nested/Client.cs @@ -7,13 +7,13 @@ // // ********************************************************************** -
-public class Client
-{
- public static void Main(string[] args)
- {
- NestedClient app = new NestedClient();
- int status = app.main(args, "config");
- System.Environment.Exit(status);
- }
-}
+ +public class Client +{ + public static void Main(string[] args) + { + NestedClient app = new NestedClient(); + int status = app.main(args, "config"); + System.Environment.Exit(status); + } +} diff --git a/cs/demo/Ice/nested/NestedClient.cs b/cs/demo/Ice/nested/NestedClient.cs index cd7eab33c0f..1fd42685567 100755 --- a/cs/demo/Ice/nested/NestedClient.cs +++ b/cs/demo/Ice/nested/NestedClient.cs @@ -7,69 +7,69 @@ // // ********************************************************************** -
-using System;
-
-class NestedClient : Ice.Application
-{
- public override int run(string[] args)
- {
- Ice.Properties properties = communicator().getProperties();
- string proxyProperty = "Nested.Client.NestedServer";
- string proxy = properties.getProperty(proxyProperty);
- if(proxy.Length == 0)
- {
- Console.Error.WriteLine("property `" + proxyProperty + "' not set");
- return 1;
- }
-
- Ice.ObjectPrx @base = communicator().stringToProxy(proxy);
- NestedPrx nested = NestedPrxHelper.checkedCast(@base);
- if(nested == null)
- {
- Console.Error.WriteLine("invalid proxy");
- return 1;
- }
-
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Nested.Client");
- NestedPrx self = NestedPrxHelper.uncheckedCast(adapter.createProxy(Ice.Util.stringToIdentity("nestedClient")));
- adapter.add(new NestedI(self), Ice.Util.stringToIdentity("nestedClient"));
- adapter.activate();
-
- Console.Out.WriteLine("Note: The maximum nesting level is sz * 2, with sz being");
- Console.Out.WriteLine("the maximum number of threads in the server thread pool. If");
- Console.Out.WriteLine("you specify a value higher than that, the application will");
- Console.Out.WriteLine("block or timeout.");
- Console.Out.WriteLine();
-
- string s = null;
- do
- {
- try
- {
- Console.Out.Write("enter nesting level or 'x' for exit: ");
- Console.Out.Flush();
- s = Console.In.ReadLine();
- if(s == null)
- {
- break;
- }
- int level = System.Int32.Parse(s);
- if(level > 0)
- {
- nested.nestedCall(level, self);
- }
- }
- catch(System.FormatException)
- {
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- }
- }
- while(!s.Equals("x"));
-
- return 0;
- }
-}
+ +using System; + +class NestedClient : Ice.Application +{ + public override int run(string[] args) + { + Ice.Properties properties = communicator().getProperties(); + string proxyProperty = "Nested.Client.NestedServer"; + string proxy = properties.getProperty(proxyProperty); + if(proxy.Length == 0) + { + Console.Error.WriteLine("property `" + proxyProperty + "' not set"); + return 1; + } + + Ice.ObjectPrx @base = communicator().stringToProxy(proxy); + NestedPrx nested = NestedPrxHelper.checkedCast(@base); + if(nested == null) + { + Console.Error.WriteLine("invalid proxy"); + return 1; + } + + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Nested.Client"); + NestedPrx self = NestedPrxHelper.uncheckedCast(adapter.createProxy(Ice.Util.stringToIdentity("nestedClient"))); + adapter.add(new NestedI(self), Ice.Util.stringToIdentity("nestedClient")); + adapter.activate(); + + Console.Out.WriteLine("Note: The maximum nesting level is sz * 2, with sz being"); + Console.Out.WriteLine("the maximum number of threads in the server thread pool. If"); + Console.Out.WriteLine("you specify a value higher than that, the application will"); + Console.Out.WriteLine("block or timeout."); + Console.Out.WriteLine(); + + string s = null; + do + { + try + { + Console.Out.Write("enter nesting level or 'x' for exit: "); + Console.Out.Flush(); + s = Console.In.ReadLine(); + if(s == null) + { + break; + } + int level = System.Int32.Parse(s); + if(level > 0) + { + nested.nestedCall(level, self); + } + } + catch(System.FormatException) + { + } + catch(System.Exception ex) + { + Console.Error.WriteLine(ex); + } + } + while(!s.Equals("x")); + + return 0; + } +} diff --git a/cs/demo/Ice/nested/NestedI.cs b/cs/demo/Ice/nested/NestedI.cs index ef7ddd56bf9..39a13222ad1 100755 --- a/cs/demo/Ice/nested/NestedI.cs +++ b/cs/demo/Ice/nested/NestedI.cs @@ -7,22 +7,22 @@ // // ********************************************************************** -
-class NestedI : Nested
-{
- internal NestedI(NestedPrx self)
- {
- _self = self;
- }
-
- public override void nestedCall(int level, NestedPrx proxy, Ice.Current current)
- {
- System.Console.Out.WriteLine("" + level);
- if(--level > 0)
- {
- proxy.nestedCall(level, _self, current.ctx);
- }
- }
-
- private NestedPrx _self;
-}
+ +class NestedI : Nested +{ + internal NestedI(NestedPrx self) + { + _self = self; + } + + public override void nestedCall(int level, NestedPrx proxy, Ice.Current current) + { + System.Console.Out.WriteLine("" + level); + if(--level > 0) + { + proxy.nestedCall(level, _self, current.ctx); + } + } + + private NestedPrx _self; +} diff --git a/cs/demo/Ice/nested/NestedServer.cs b/cs/demo/Ice/nested/NestedServer.cs index 02f4467c438..94377194e4a 100755 --- a/cs/demo/Ice/nested/NestedServer.cs +++ b/cs/demo/Ice/nested/NestedServer.cs @@ -7,16 +7,16 @@ // // ********************************************************************** -
-class NestedServer : Ice.Application
-{
- public override int run(string[] args)
- {
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Nested.Server");
- NestedPrx self = NestedPrxHelper.uncheckedCast(adapter.createProxy(Ice.Util.stringToIdentity("nestedServer")));
- adapter.add(new NestedI(self), Ice.Util.stringToIdentity("nestedServer"));
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
- }
-}
+ +class NestedServer : Ice.Application +{ + public override int run(string[] args) + { + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Nested.Server"); + NestedPrx self = NestedPrxHelper.uncheckedCast(adapter.createProxy(Ice.Util.stringToIdentity("nestedServer"))); + adapter.add(new NestedI(self), Ice.Util.stringToIdentity("nestedServer")); + adapter.activate(); + communicator().waitForShutdown(); + return 0; + } +} diff --git a/cs/demo/Ice/nested/Server.cs b/cs/demo/Ice/nested/Server.cs index 853f6b0a629..eabccce0a57 100755 --- a/cs/demo/Ice/nested/Server.cs +++ b/cs/demo/Ice/nested/Server.cs @@ -7,13 +7,13 @@ // // ********************************************************************** -
-public class Server
-{
- public static void Main(string[] args)
- {
- NestedServer app = new NestedServer();
- int status = app.main(args, "config.server");
- System.Environment.Exit(status);
- }
-}
+ +public class Server +{ + public static void Main(string[] args) + { + NestedServer app = new NestedServer(); + int status = app.main(args, "config.server"); + System.Environment.Exit(status); + } +} diff --git a/cs/demo/Ice/throughput/Client.cs b/cs/demo/Ice/throughput/Client.cs index 14323a7af6c..5c177a96c48 100755 --- a/cs/demo/Ice/throughput/Client.cs +++ b/cs/demo/Ice/throughput/Client.cs @@ -7,192 +7,192 @@ // // ********************************************************************** -
-using System;
-
-public class Client
-{
- private static void menu()
- {
- Console.Out.WriteLine("usage:\n"
- + "s: send byte sequence\n"
- + "o: send byte sequence as oneway\n"
- + "r: receive byte sequence\n"
- + "e: echo (send and receive) byte sequence\n"
- + "x: exit\n"
- + "?: help\n");
- }
-
- private static int run(string[] args, Ice.Communicator communicator)
- {
- Ice.Properties properties = communicator.getProperties();
- string refProperty = "Throughput.Throughput";
- string r = properties.getProperty(refProperty);
- if(r.Length == 0)
- {
- Console.Error.WriteLine("property `" + r + "' not set");
- return 1;
- }
-
- Ice.ObjectPrx b = communicator.stringToProxy(r);
- ThroughputPrx throughput = ThroughputPrxHelper.checkedCast(b);
- if(throughput == null)
- {
- Console.Error.WriteLine("invalid proxy");
- return 1;
- }
- ThroughputPrx throughputOneway = ThroughputPrxHelper.uncheckedCast(throughput.ice_oneway());
-
- byte[] seq = new byte[seqSize.value];
-
- menu();
-
- string line = null;
- do
- {
- try
- {
- Console.Out.Write("==> ");
- Console.Out.Flush();
- line = Console.In.ReadLine();
- if(line == null)
- {
- break;
- }
-
- // Initial ping to setup the connection.
- throughput.ice_ping();
-
- long tmsec = System.DateTime.Now.Ticks / 10000;
-
- int repetitions = 100;
-
- if(line.Equals("s") || line.Equals("o") || line.Equals("r") || line.Equals("e"))
- {
- char c = line[0];
-
- switch (c)
- {
- case 's':
- case 'o':
- {
- Console.Out.Write("sending");
- break;
- }
- case 'r':
- {
- Console.Out.Write("receiving");
- break;
- }
- case 'e':
- {
- Console.Out.Write("sending and receiving");
- break;
- }
- }
-
- Console.Out.Write(" " + repetitions + " sequences of size " + seqSize.value);
-
- if(c == 'o')
- {
- Console.Out.Write(" as oneway");
- }
-
- Console.Out.WriteLine("...");
-
- for (int i = 0; i < repetitions; ++i)
- {
- switch (c)
- {
-
- case 's':
- {
- throughput.sendByteSeq(seq);
- break;
- }
-
-
- case 'o':
- {
- throughputOneway.sendByteSeq(seq);
- break;
- }
-
-
- case 'r':
- {
- throughput.recvByteSeq();
- break;
- }
-
-
- case 'e':
- {
- throughput.echoByteSeq(seq);
- break;
- }
- }
- }
-
- double dmsec = System.DateTime.Now.Ticks / 10000 - tmsec;
- Console.Out.WriteLine("time for " + repetitions + " sequences: " + dmsec.ToString("F") + "ms");
- Console.Out.WriteLine("time per sequence: " + ((double)(dmsec / repetitions)).ToString("F") + "ms");
- double mbit = repetitions * seqSize.value * 8.0 / dmsec / 1000.0;
- if(c == 'e')
- {
- mbit *= 2;
- }
- Console.Out.WriteLine("throughput: " + mbit.ToString("F") + "MBit/s");
- }
- else if(line.Equals("x"))
- {
- // Nothing to do
- }
- else if(line.Equals("?"))
- {
- menu();
- }
- else
- {
- Console.Out.WriteLine("unknown command `" + line + "'");
- menu();
- }
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- }
- }
- while(!line.Equals("x"));
-
- return 0;
- }
-
- public static void Main(string[] args)
- {
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.Properties properties = Ice.Util.createProperties(ref args);
- properties.load("config");
- communicator = Ice.Util.initializeWithProperties(ref args, properties);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- finally
- {
- if(communicator != null)
- {
- communicator.destroy();
- }
- }
-
- System.Environment.Exit(status);
- }
-}
+ +using System; + +public class Client +{ + private static void menu() + { + Console.Out.WriteLine("usage:\n" + + "s: send byte sequence\n" + + "o: send byte sequence as oneway\n" + + "r: receive byte sequence\n" + + "e: echo (send and receive) byte sequence\n" + + "x: exit\n" + + "?: help\n"); + } + + private static int run(string[] args, Ice.Communicator communicator) + { + Ice.Properties properties = communicator.getProperties(); + string refProperty = "Throughput.Throughput"; + string r = properties.getProperty(refProperty); + if(r.Length == 0) + { + Console.Error.WriteLine("property `" + r + "' not set"); + return 1; + } + + Ice.ObjectPrx b = communicator.stringToProxy(r); + ThroughputPrx throughput = ThroughputPrxHelper.checkedCast(b); + if(throughput == null) + { + Console.Error.WriteLine("invalid proxy"); + return 1; + } + ThroughputPrx throughputOneway = ThroughputPrxHelper.uncheckedCast(throughput.ice_oneway()); + + byte[] seq = new byte[seqSize.value]; + + menu(); + + string line = null; + do + { + try + { + Console.Out.Write("==> "); + Console.Out.Flush(); + line = Console.In.ReadLine(); + if(line == null) + { + break; + } + + // Initial ping to setup the connection. + throughput.ice_ping(); + + long tmsec = System.DateTime.Now.Ticks / 10000; + + int repetitions = 100; + + if(line.Equals("s") || line.Equals("o") || line.Equals("r") || line.Equals("e")) + { + char c = line[0]; + + switch (c) + { + case 's': + case 'o': + { + Console.Out.Write("sending"); + break; + } + case 'r': + { + Console.Out.Write("receiving"); + break; + } + case 'e': + { + Console.Out.Write("sending and receiving"); + break; + } + } + + Console.Out.Write(" " + repetitions + " sequences of size " + seqSize.value); + + if(c == 'o') + { + Console.Out.Write(" as oneway"); + } + + Console.Out.WriteLine("..."); + + for (int i = 0; i < repetitions; ++i) + { + switch (c) + { + + case 's': + { + throughput.sendByteSeq(seq); + break; + } + + + case 'o': + { + throughputOneway.sendByteSeq(seq); + break; + } + + + case 'r': + { + throughput.recvByteSeq(); + break; + } + + + case 'e': + { + throughput.echoByteSeq(seq); + break; + } + } + } + + double dmsec = System.DateTime.Now.Ticks / 10000 - tmsec; + Console.Out.WriteLine("time for " + repetitions + " sequences: " + dmsec.ToString("F") + "ms"); + Console.Out.WriteLine("time per sequence: " + ((double)(dmsec / repetitions)).ToString("F") + "ms"); + double mbit = repetitions * seqSize.value * 8.0 / dmsec / 1000.0; + if(c == 'e') + { + mbit *= 2; + } + Console.Out.WriteLine("throughput: " + mbit.ToString("F") + "MBit/s"); + } + else if(line.Equals("x")) + { + // Nothing to do + } + else if(line.Equals("?")) + { + menu(); + } + else + { + Console.Out.WriteLine("unknown command `" + line + "'"); + menu(); + } + } + catch(System.Exception ex) + { + Console.Error.WriteLine(ex); + } + } + while(!line.Equals("x")); + + return 0; + } + + public static void Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + Ice.Properties properties = Ice.Util.createProperties(ref args); + properties.load("config"); + communicator = Ice.Util.initializeWithProperties(ref args, properties); + status = run(args, communicator); + } + catch(System.Exception ex) + { + Console.Error.WriteLine(ex); + status = 1; + } + finally + { + if(communicator != null) + { + communicator.destroy(); + } + } + + System.Environment.Exit(status); + } +} diff --git a/cs/demo/Ice/throughput/Server.cs b/cs/demo/Ice/throughput/Server.cs index 74100665a87..43382913d4a 100755 --- a/cs/demo/Ice/throughput/Server.cs +++ b/cs/demo/Ice/throughput/Server.cs @@ -7,44 +7,44 @@ // // ********************************************************************** -
-public class Server
-{
- private static int run(string[] args, Ice.Communicator communicator)
- {
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("Throughput");
- Ice.Object obj = new ThroughputI();
- adapter.add(obj, Ice.Util.stringToIdentity("throughput"));
- adapter.activate();
- communicator.waitForShutdown();
- return 0;
- }
-
- public static void Main(string[] args)
- {
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.Properties properties = Ice.Util.createProperties(ref args);
- properties.load("config");
- communicator = Ice.Util.initializeWithProperties(ref args, properties);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
- finally
- {
- if(communicator != null)
- {
- communicator.destroy();
- }
- }
-
- System.Environment.Exit(status);
- }
-}
+ +public class Server +{ + private static int run(string[] args, Ice.Communicator communicator) + { + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("Throughput"); + Ice.Object obj = new ThroughputI(); + adapter.add(obj, Ice.Util.stringToIdentity("throughput")); + adapter.activate(); + communicator.waitForShutdown(); + return 0; + } + + public static void Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + Ice.Properties properties = Ice.Util.createProperties(ref args); + properties.load("config"); + communicator = Ice.Util.initializeWithProperties(ref args, properties); + status = run(args, communicator); + } + catch(System.Exception ex) + { + System.Console.Error.WriteLine(ex); + status = 1; + } + finally + { + if(communicator != null) + { + communicator.destroy(); + } + } + + System.Environment.Exit(status); + } +} diff --git a/cs/demo/Ice/throughput/ThroughputI.cs b/cs/demo/Ice/throughput/ThroughputI.cs index c19454e9f52..6cbc3a53f51 100755 --- a/cs/demo/Ice/throughput/ThroughputI.cs +++ b/cs/demo/Ice/throughput/ThroughputI.cs @@ -7,27 +7,27 @@ // // ********************************************************************** -
-public sealed class ThroughputI : _ThroughputDisp
-{
- public ThroughputI()
- {
- _seq = new byte[seqSize.value];
- }
-
- public override byte[] echoByteSeq(byte[] seq, Ice.Current current)
- {
- return seq;
- }
-
- public override byte[] recvByteSeq(Ice.Current current)
- {
- return _seq;
- }
-
- public override void sendByteSeq(byte[] seq, Ice.Current current)
- {
- }
-
- private byte[] _seq;
-}
+ +public sealed class ThroughputI : _ThroughputDisp +{ + public ThroughputI() + { + _seq = new byte[seqSize.value]; + } + + public override byte[] echoByteSeq(byte[] seq, Ice.Current current) + { + return seq; + } + + public override byte[] recvByteSeq(Ice.Current current) + { + return _seq; + } + + public override void sendByteSeq(byte[] seq, Ice.Current current) + { + } + + private byte[] _seq; +} diff --git a/cs/demo/Ice/value/DerivedPrinterI.cs b/cs/demo/Ice/value/DerivedPrinterI.cs index 72966b1b106..99fa35b5313 100755 --- a/cs/demo/Ice/value/DerivedPrinterI.cs +++ b/cs/demo/Ice/value/DerivedPrinterI.cs @@ -7,23 +7,23 @@ // // ********************************************************************** -
-class DerivedPrinterI : DerivedPrinter
-{
- public override void printBackwards(Ice.Current current)
- {
- char[] arr = message.ToCharArray();
- for(int i = 0; i < arr.Length / 2; i++)
- {
- char tmp = arr[arr.Length - i - 1];
- arr[arr.Length - i - 1] = arr[i];
- arr[i] = tmp;
- }
- System.Console.Out.WriteLine(new System.String(arr));
- }
-
- public override void printUppercase(Ice.Current current)
- {
- System.Console.Out.WriteLine(derivedMessage.ToUpper());
- }
-}
+ +class DerivedPrinterI : DerivedPrinter +{ + public override void printBackwards(Ice.Current current) + { + char[] arr = message.ToCharArray(); + for(int i = 0; i < arr.Length / 2; i++) + { + char tmp = arr[arr.Length - i - 1]; + arr[arr.Length - i - 1] = arr[i]; + arr[i] = tmp; + } + System.Console.Out.WriteLine(new System.String(arr)); + } + + public override void printUppercase(Ice.Current current) + { + System.Console.Out.WriteLine(derivedMessage.ToUpper()); + } +} diff --git a/cs/demo/Ice/value/InitialI.cs b/cs/demo/Ice/value/InitialI.cs index 1c9d5110500..c0500b4ec6f 100755 --- a/cs/demo/Ice/value/InitialI.cs +++ b/cs/demo/Ice/value/InitialI.cs @@ -7,54 +7,54 @@ // // ********************************************************************** -
-class InitialI : Initial
-{
- internal InitialI(Ice.ObjectAdapter adapter)
- {
- _simple = new Simple();
- _simple.message = "a message 4 u";
-
- _printer = new PrinterI();
- _printer.message = "Ice rulez!";
- _printerProxy = PrinterPrxHelper.uncheckedCast(adapter.addWithUUID(_printer));
-
- _derivedPrinter = new DerivedPrinterI();
- _derivedPrinter.message = _printer.message;
- _derivedPrinter.derivedMessage = "a derived message 4 u";
- adapter.addWithUUID(_derivedPrinter);
- }
-
- public override Simple getSimple(Ice.Current current)
- {
- return _simple;
- }
-
- public override Ice.Object getPrinterAsObject(Ice.Current current)
- {
- return _printer;
- }
-
- public override void getPrinter(out Printer impl, out PrinterPrx proxy, Ice.Current current)
- {
- impl = _printer;
- proxy = _printerProxy;
- }
-
- public override Printer getDerivedPrinter(Ice.Current current)
- {
- return _derivedPrinter;
- }
-
- public override void throwDerivedPrinter(Ice.Current current)
- {
- DerivedPrinterException ex = new DerivedPrinterException();
- ex.derived = _derivedPrinter;
- throw ex;
- }
-
- private Simple _simple;
- private Printer _printer;
- private PrinterPrx _printerProxy;
- private DerivedPrinter _derivedPrinter;
-}
+ +class InitialI : Initial +{ + internal InitialI(Ice.ObjectAdapter adapter) + { + _simple = new Simple(); + _simple.message = "a message 4 u"; + + _printer = new PrinterI(); + _printer.message = "Ice rulez!"; + _printerProxy = PrinterPrxHelper.uncheckedCast(adapter.addWithUUID(_printer)); + + _derivedPrinter = new DerivedPrinterI(); + _derivedPrinter.message = _printer.message; + _derivedPrinter.derivedMessage = "a derived message 4 u"; + adapter.addWithUUID(_derivedPrinter); + } + + public override Simple getSimple(Ice.Current current) + { + return _simple; + } + + public override Ice.Object getPrinterAsObject(Ice.Current current) + { + return _printer; + } + + public override void getPrinter(out Printer impl, out PrinterPrx proxy, Ice.Current current) + { + impl = _printer; + proxy = _printerProxy; + } + + public override Printer getDerivedPrinter(Ice.Current current) + { + return _derivedPrinter; + } + + public override void throwDerivedPrinter(Ice.Current current) + { + DerivedPrinterException ex = new DerivedPrinterException(); + ex.derived = _derivedPrinter; + throw ex; + } + + private Simple _simple; + private Printer _printer; + private PrinterPrx _printerProxy; + private DerivedPrinter _derivedPrinter; +} diff --git a/cs/demo/Ice/value/ObjectFactory.cs b/cs/demo/Ice/value/ObjectFactory.cs index 64e65e00b04..91d856f527f 100755 --- a/cs/demo/Ice/value/ObjectFactory.cs +++ b/cs/demo/Ice/value/ObjectFactory.cs @@ -7,29 +7,29 @@ // // ********************************************************************** -
-using System.Diagnostics;
-
-class ObjectFactory : Ice.LocalObjectImpl, Ice.ObjectFactory
-{
- public virtual Ice.Object create(string type)
- {
- if(type.Equals("::Printer"))
- {
- return new PrinterI();
- }
-
- if(type.Equals("::DerivedPrinter"))
- {
- return new DerivedPrinterI();
- }
-
- Debug.Assert(false);
- return null;
- }
-
- public virtual void destroy()
- {
- // Nothing to do
- }
-}
+ +using System.Diagnostics; + +class ObjectFactory : Ice.LocalObjectImpl, Ice.ObjectFactory +{ + public virtual Ice.Object create(string type) + { + if(type.Equals("::Printer")) + { + return new PrinterI(); + } + + if(type.Equals("::DerivedPrinter")) + { + return new DerivedPrinterI(); + } + + Debug.Assert(false); + return null; + } + + public virtual void destroy() + { + // Nothing to do + } +} diff --git a/cs/demo/Ice/value/PrinterI.cs b/cs/demo/Ice/value/PrinterI.cs index f4f80d40836..5c6d51d4c74 100755 --- a/cs/demo/Ice/value/PrinterI.cs +++ b/cs/demo/Ice/value/PrinterI.cs @@ -7,18 +7,18 @@ // // ********************************************************************** -
-class PrinterI : Printer
-{
- public override void printBackwards(Ice.Current current)
- {
- char[] arr = message.ToCharArray();
- for(int i = 0; i < arr.Length / 2; i++)
- {
- char tmp = arr[arr.Length - i - 1];
- arr[arr.Length - i - 1] = arr[i];
- arr[i] = tmp;
- }
- System.Console.Out.WriteLine(new string(arr));
- }
-}
+ +class PrinterI : Printer +{ + public override void printBackwards(Ice.Current current) + { + char[] arr = message.ToCharArray(); + for(int i = 0; i < arr.Length / 2; i++) + { + char tmp = arr[arr.Length - i - 1]; + arr[arr.Length - i - 1] = arr[i]; + arr[i] = tmp; + } + System.Console.Out.WriteLine(new string(arr)); + } +} diff --git a/cs/demo/Ice/value/Server.cs b/cs/demo/Ice/value/Server.cs index 4d5aece9dc3..3b57ef0dd8d 100755 --- a/cs/demo/Ice/value/Server.cs +++ b/cs/demo/Ice/value/Server.cs @@ -7,44 +7,44 @@ // // ********************************************************************** -
-public class Server
-{
- private static int run(string[] args, Ice.Communicator communicator)
- {
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("Value");
- Ice.Object @object = new InitialI(adapter);
- adapter.add(@object, Ice.Util.stringToIdentity("initial"));
- adapter.activate();
- communicator.waitForShutdown();
- return 0;
- }
-
- public static void Main(string[] args)
- {
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.Properties properties = Ice.Util.createProperties(ref args);
- properties.load("config");
- communicator = Ice.Util.initializeWithProperties(ref args, properties);
- status = run(args, communicator);
- }
- catch (System.Exception ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
- finally
- {
- if(communicator != null)
- {
- communicator.destroy();
- }
- }
-
- System.Environment.Exit(status);
- }
-}
+ +public class Server +{ + private static int run(string[] args, Ice.Communicator communicator) + { + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("Value"); + Ice.Object @object = new InitialI(adapter); + adapter.add(@object, Ice.Util.stringToIdentity("initial")); + adapter.activate(); + communicator.waitForShutdown(); + return 0; + } + + public static void Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + Ice.Properties properties = Ice.Util.createProperties(ref args); + properties.load("config"); + communicator = Ice.Util.initializeWithProperties(ref args, properties); + status = run(args, communicator); + } + catch (System.Exception ex) + { + System.Console.Error.WriteLine(ex); + status = 1; + } + finally + { + if(communicator != null) + { + communicator.destroy(); + } + } + + System.Environment.Exit(status); + } +} diff --git a/cs/generate/AssemblyInfo.cs b/cs/generate/AssemblyInfo.cs index 6a840fcc1ed..88e1bc1236e 100755 --- a/cs/generate/AssemblyInfo.cs +++ b/cs/generate/AssemblyInfo.cs @@ -1,15 +1,15 @@ -using System.Reflection;
-using System.Runtime.CompilerServices;
-
-[assembly: AssemblyTitle("generate")]
-[assembly: AssemblyDescription("Make-like program to compile Slice files")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("ZerocC, Inc.")]
-[assembly: AssemblyProduct("Ice for C# Pre-Build Event Program")]
-[assembly: AssemblyCopyright("2004")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("1.0")]
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
-[assembly: AssemblyKeyName("")]
+using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("generate")] +[assembly: AssemblyDescription("Make-like program to compile Slice files")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("ZerocC, Inc.")] +[assembly: AssemblyProduct("Ice for C# Pre-Build Event Program")] +[assembly: AssemblyCopyright("2004")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyVersion("1.0")] +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/cs/src/Ice/Acceptor.cs b/cs/src/Ice/Acceptor.cs index 885eed2d001..dea14c4791d 100755 --- a/cs/src/Ice/Acceptor.cs +++ b/cs/src/Ice/Acceptor.cs @@ -7,19 +7,19 @@ // // ********************************************************************** -
-namespace IceInternal
-{
-
- using System.Net.Sockets;
-
- public interface Acceptor
- {
- Socket fd();
- void close();
- void listen();
- Transceiver accept(int timeout);
- string ToString();
- }
-
-}
+ +namespace IceInternal +{ + + using System.Net.Sockets; + + public interface Acceptor + { + Socket fd(); + void close(); + void listen(); + Transceiver accept(int timeout); + string ToString(); + } + +} diff --git a/cs/src/Ice/Application.cs b/cs/src/Ice/Application.cs index fe6b96eb0d6..f1268e1264a 100755 --- a/cs/src/Ice/Application.cs +++ b/cs/src/Ice/Application.cs @@ -7,316 +7,316 @@ // // ********************************************************************** -
-namespace Ice
-{
-
- using System;
- using System.Diagnostics;
- using System.Runtime.InteropServices;
- using System.Threading;
-
- public abstract class Application
- {
- public abstract int run(string[] args);
-
- public Application()
- {
- bool rc;
- rc = SetConsoleCtrlHandler(_handler, true);
- Debug.Assert(rc);
- _callback = null;
- _released = false;
- _interrupted = false;
- _nohup = false;
- }
-
- //
- // This main() must be called by the global Main(). main()
- // initializes the Communicator, calls run(), and destroys
- // the Communicator upon return from run(). It thereby handles
- // all exceptions properly, i.e., error messages are printed
- // if exceptions propagate to main(), and the Communicator is
- // always destroyed, regardless of exceptions.
- //
- public int main(string[] args)
- {
- return main(args, null);
- }
-
- public int main(string[] args, string configFile)
- {
- if(_communicator != null)
- {
- Console.Error.WriteLine(_appName + ": only one instance of the Application class can be used");
- return 1;
- }
- int status = 0;
-
- try
- {
- if(configFile != null)
- {
- Properties properties = Util.createProperties(ref args);
- properties.load(configFile);
- _communicator = Util.initializeWithProperties(ref args, properties);
- }
- else
- {
- _communicator = Util.initialize(ref args);
- }
-
- Properties props = _communicator.getProperties();
- _nohup = props.getPropertyAsInt("Ice.Nohup") != 0;
- _appName = props.getProperty("Ice.ProgramName");
-
- //
- // The default is to destroy when a signal is received.
- //
- destroyOnInterrupt();
-
- status = run(args);
- }
- catch(Ice.Exception ex)
- {
- Console.Error.WriteLine(_appName + ": " + ex);
- status = 1;
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(_appName + ": unknown exception: " + ex);
- status = 1;
- }
-
- if(_communicator != null)
- {
- try
- {
- _communicator.destroy();
- }
- catch(Ice.Exception ex)
- {
- Console.Error.WriteLine(_appName + ": " + ex);
- status = 1;
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(_appName + ": unknown exception: " + ex);
- status = 1;
- }
- _communicator = null;
- }
- return status;
- }
-
-
-
- //
- // Return the application name.
- //
- public static string appName()
- {
- return _appName;
- }
-
- //
- // One limitation of this class is that there can only be one
- // Application instance, with one global Communicator, accessible
- // with this communicator() operation. This limitiation is due to
- // how the signal handling functions below operate. If you require
- // multiple Communicators, then you cannot use this Application
- // framework class.
- //
- public static Communicator communicator()
- {
- return _communicator;
- }
-
- public static void destroyOnInterrupt()
- {
- Monitor.Enter(sync);
- if(_callback == _holdCallback)
- {
- _callback = _destroyCallback;
- _released = true;
- Monitor.Pulse(sync);
- }
- else
- {
- _callback = _destroyCallback;
- }
- Monitor.Exit(sync);
- }
-
- public static void shutdownOnInterrupt()
- {
- Monitor.Enter(sync);
- if(_callback == _holdCallback)
- {
- _callback = _shutdownCallback;
- _released = true;
- Monitor.Pulse(sync);
- }
- else
- {
- _callback = _shutdownCallback;
- }
- Monitor.Exit(sync);
- }
-
- public static void ignoreInterrupt()
- {
- Monitor.Enter(sync);
- if(_callback == _holdCallback)
- {
- _callback = null;
- _released = true;
- Monitor.Pulse(sync);
- }
- else
- {
- _callback = null;
- }
- Monitor.Exit(sync);
- }
-
- public static void holdInterrupt()
- {
- Monitor.Enter(sync);
- if(_callback != _holdCallback)
- {
- _previousCallback = _callback;
- _callback = _holdCallback;
- _released = true;
- }
- Monitor.Exit(sync);
- }
-
- public static void releaseInterrupt()
- {
- Monitor.Enter(sync);
- if(_callback == _holdCallback)
- {
- _callback = _previousCallback;
- _released = true;
- Monitor.Pulse(sync);
- }
- Monitor.Exit(sync);
- }
-
- public static bool interrupted()
- {
- Monitor.Enter(sync);
- bool rc = _interrupted;
- Monitor.Exit(sync);
- return rc;
- }
-
-
- //
- // First-level handler
- //
- private static Boolean HandlerRoutine(int sig)
- {
- Monitor.Enter(sync);
- Callback callback = _callback;
- Monitor.Exit(sync);
- if(callback != null)
- {
- try
- {
- callback(sig);
- }
- catch(System.Exception)
- {
- Debug.Assert(false);
- }
- }
- return true;
- }
- //
- // The callbacks to be invoked from the handler.
- //
- private static void destroyOnInterruptCallback(int sig)
- {
- if(_nohup && sig == SIGHUP)
- {
- return;
- }
-
- Monitor.Enter(sync);
- _interrupted = true;
- Monitor.Exit(sync);
-
- try
- {
- _communicator.destroy();
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(_appName + ": while destroying in response to signal: " + ex);
- }
- }
-
- private static void shutdownOnInterruptCallback(int sig)
- {
- if(_nohup && sig == SIGHUP)
- {
- return;
- }
-
- Monitor.Enter(sync);
- _interrupted = true;
- Monitor.Exit(sync);
-
- try
- {
- _communicator.shutdown();
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(_appName + ": while destroying in response to signal: " + ex);
- }
- }
-
- private static void holdInterruptCallback(int sig)
- {
- Monitor.Enter(sync);
- while(!_released)
- {
- Monitor.Wait(sync);
- }
- if(_callback != null)
- {
- _callback(sig);
- }
- Monitor.Exit(sync);
- }
-
- [DllImport("kernel32.dll")]
- private static extern Boolean SetConsoleCtrlHandler(Application.EventHandler eh, Boolean add);
-
- private static readonly object sync = typeof(Application);
-
- private const int SIGHUP = 5; // CTRL_LOGOFF_EVENT, from wincon.h
-
- private static bool _interrupted;
- private static bool _released;
- private static bool _nohup;
-
- private delegate Boolean EventHandler(int sig);
- private static readonly Application.EventHandler _handler
- = new Application.EventHandler(HandlerRoutine); // First-level handler
-
- private delegate void Callback(int sig);
- private static readonly Callback _destroyCallback = new Callback(destroyOnInterruptCallback);
- private static readonly Callback _shutdownCallback = new Callback(shutdownOnInterruptCallback);
- private static readonly Callback _holdCallback = new Callback(holdInterruptCallback);
-
- private static Callback _callback; // Current callback
- private static Callback _previousCallback; // Remembers prev. callback when signals are held
-
- private static volatile string _appName = AppDomain.CurrentDomain.FriendlyName;
- private static Communicator _communicator;
- }
-}
+ +namespace Ice +{ + + using System; + using System.Diagnostics; + using System.Runtime.InteropServices; + using System.Threading; + + public abstract class Application + { + public abstract int run(string[] args); + + public Application() + { + bool rc; + rc = SetConsoleCtrlHandler(_handler, true); + Debug.Assert(rc); + _callback = null; + _released = false; + _interrupted = false; + _nohup = false; + } + + // + // This main() must be called by the global Main(). main() + // initializes the Communicator, calls run(), and destroys + // the Communicator upon return from run(). It thereby handles + // all exceptions properly, i.e., error messages are printed + // if exceptions propagate to main(), and the Communicator is + // always destroyed, regardless of exceptions. + // + public int main(string[] args) + { + return main(args, null); + } + + public int main(string[] args, string configFile) + { + if(_communicator != null) + { + Console.Error.WriteLine(_appName + ": only one instance of the Application class can be used"); + return 1; + } + int status = 0; + + try + { + if(configFile != null) + { + Properties properties = Util.createProperties(ref args); + properties.load(configFile); + _communicator = Util.initializeWithProperties(ref args, properties); + } + else + { + _communicator = Util.initialize(ref args); + } + + Properties props = _communicator.getProperties(); + _nohup = props.getPropertyAsInt("Ice.Nohup") != 0; + _appName = props.getProperty("Ice.ProgramName"); + + // + // The default is to destroy when a signal is received. + // + destroyOnInterrupt(); + + status = run(args); + } + catch(Ice.Exception ex) + { + Console.Error.WriteLine(_appName + ": " + ex); + status = 1; + } + catch(System.Exception ex) + { + Console.Error.WriteLine(_appName + ": unknown exception: " + ex); + status = 1; + } + + if(_communicator != null) + { + try + { + _communicator.destroy(); + } + catch(Ice.Exception ex) + { + Console.Error.WriteLine(_appName + ": " + ex); + status = 1; + } + catch(System.Exception ex) + { + Console.Error.WriteLine(_appName + ": unknown exception: " + ex); + status = 1; + } + _communicator = null; + } + return status; + } + + + + // + // Return the application name. + // + public static string appName() + { + return _appName; + } + + // + // One limitation of this class is that there can only be one + // Application instance, with one global Communicator, accessible + // with this communicator() operation. This limitiation is due to + // how the signal handling functions below operate. If you require + // multiple Communicators, then you cannot use this Application + // framework class. + // + public static Communicator communicator() + { + return _communicator; + } + + public static void destroyOnInterrupt() + { + Monitor.Enter(sync); + if(_callback == _holdCallback) + { + _callback = _destroyCallback; + _released = true; + Monitor.Pulse(sync); + } + else + { + _callback = _destroyCallback; + } + Monitor.Exit(sync); + } + + public static void shutdownOnInterrupt() + { + Monitor.Enter(sync); + if(_callback == _holdCallback) + { + _callback = _shutdownCallback; + _released = true; + Monitor.Pulse(sync); + } + else + { + _callback = _shutdownCallback; + } + Monitor.Exit(sync); + } + + public static void ignoreInterrupt() + { + Monitor.Enter(sync); + if(_callback == _holdCallback) + { + _callback = null; + _released = true; + Monitor.Pulse(sync); + } + else + { + _callback = null; + } + Monitor.Exit(sync); + } + + public static void holdInterrupt() + { + Monitor.Enter(sync); + if(_callback != _holdCallback) + { + _previousCallback = _callback; + _callback = _holdCallback; + _released = true; + } + Monitor.Exit(sync); + } + + public static void releaseInterrupt() + { + Monitor.Enter(sync); + if(_callback == _holdCallback) + { + _callback = _previousCallback; + _released = true; + Monitor.Pulse(sync); + } + Monitor.Exit(sync); + } + + public static bool interrupted() + { + Monitor.Enter(sync); + bool rc = _interrupted; + Monitor.Exit(sync); + return rc; + } + + + // + // First-level handler + // + private static Boolean HandlerRoutine(int sig) + { + Monitor.Enter(sync); + Callback callback = _callback; + Monitor.Exit(sync); + if(callback != null) + { + try + { + callback(sig); + } + catch(System.Exception) + { + Debug.Assert(false); + } + } + return true; + } + // + // The callbacks to be invoked from the handler. + // + private static void destroyOnInterruptCallback(int sig) + { + if(_nohup && sig == SIGHUP) + { + return; + } + + Monitor.Enter(sync); + _interrupted = true; + Monitor.Exit(sync); + + try + { + _communicator.destroy(); + } + catch(System.Exception ex) + { + Console.Error.WriteLine(_appName + ": while destroying in response to signal: " + ex); + } + } + + private static void shutdownOnInterruptCallback(int sig) + { + if(_nohup && sig == SIGHUP) + { + return; + } + + Monitor.Enter(sync); + _interrupted = true; + Monitor.Exit(sync); + + try + { + _communicator.shutdown(); + } + catch(System.Exception ex) + { + Console.Error.WriteLine(_appName + ": while destroying in response to signal: " + ex); + } + } + + private static void holdInterruptCallback(int sig) + { + Monitor.Enter(sync); + while(!_released) + { + Monitor.Wait(sync); + } + if(_callback != null) + { + _callback(sig); + } + Monitor.Exit(sync); + } + + [DllImport("kernel32.dll")] + private static extern Boolean SetConsoleCtrlHandler(Application.EventHandler eh, Boolean add); + + private static readonly object sync = typeof(Application); + + private const int SIGHUP = 5; // CTRL_LOGOFF_EVENT, from wincon.h + + private static bool _interrupted; + private static bool _released; + private static bool _nohup; + + private delegate Boolean EventHandler(int sig); + private static readonly Application.EventHandler _handler + = new Application.EventHandler(HandlerRoutine); // First-level handler + + private delegate void Callback(int sig); + private static readonly Callback _destroyCallback = new Callback(destroyOnInterruptCallback); + private static readonly Callback _shutdownCallback = new Callback(shutdownOnInterruptCallback); + private static readonly Callback _holdCallback = new Callback(holdInterruptCallback); + + private static Callback _callback; // Current callback + private static Callback _previousCallback; // Remembers prev. callback when signals are held + + private static volatile string _appName = AppDomain.CurrentDomain.FriendlyName; + private static Communicator _communicator; + } +} diff --git a/cs/src/Ice/AssemblyUtil.cs b/cs/src/Ice/AssemblyUtil.cs index d9d8f54887f..c320d0e30f1 100755 --- a/cs/src/Ice/AssemblyUtil.cs +++ b/cs/src/Ice/AssemblyUtil.cs @@ -18,51 +18,11 @@ namespace IceInternal sealed class AssemblyUtil { - // - // Make sure that all assemblies that are referenced by this process - // are actually loaded. This is necessary so we can use reflection - // on any type in any assembly (because the type we are after will - // most likely not be in the current assembly and, worse, may be - // in an assembly that has not been loaded yet. (Type.GetType() - // is no good because it looks only in the calling object's assembly - // and mscorlib.dll.) - // - public static void loadAssemblies() - { - if(!_assembliesLoaded) // Lazy initialization - { - _mutex.WaitOne(); - try - { - if(!_assembliesLoaded) // Double-checked locking - { - Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); - foreach(Assembly a in assemblies) - { - _loadedAssemblies[a.FullName] = a; - } - foreach(Assembly a in assemblies) - { - loadReferencedAssemblies(a); - } - _assembliesLoaded = true; - } - } - catch(Exception) - { - Debug.Assert(false); - } - finally - { - _mutex.ReleaseMutex(); - } - } - } - public static Type findType(string csharpId) { - _mutex.WaitOne(); - try + loadAssemblies(); // Lazy initialization + + lock(_mutex) // MONO BUG: Should be WaitOne(), but that's broken under Mono 1.0 for Linux. { Type t = (Type)_typeTable[csharpId]; if(t != null) @@ -78,10 +38,6 @@ namespace IceInternal } } } - finally - { - _mutex.ReleaseMutex(); - } return null; } @@ -89,8 +45,9 @@ namespace IceInternal { IceUtil.LinkedList l = new IceUtil.LinkedList(); - _mutex.WaitOne(); - try + loadAssemblies(); // Lazy initialization + + lock(_mutex) // MONO BUG: Should be WaitOne(), but that's broken under Mono 1.0 for Linux. { foreach(Assembly a in _loadedAssemblies.Values) { @@ -104,10 +61,6 @@ namespace IceInternal } } } - finally - { - _mutex.ReleaseMutex(); - } Type[] result = new Type[l.Count]; if(l.Count > 0) @@ -117,20 +70,6 @@ namespace IceInternal return result; } - private static void loadReferencedAssemblies(Assembly a) - { - AssemblyName[] names = a.GetReferencedAssemblies(); - foreach(AssemblyName name in names) - { - if(!_loadedAssemblies.Contains(name.FullName)) - { - Assembly ra = Assembly.Load(name); - _loadedAssemblies[ra.FullName] = ra; - loadReferencedAssemblies(ra); - } - } - } - public static object createInstance(Type t) { ConstructorInfo[] constructors = t.GetConstructors(); @@ -152,6 +91,52 @@ namespace IceInternal return t.GetConstructor(constructor).Invoke(new object[]{}); } + // + // Make sure that all assemblies that are referenced by this process + // are actually loaded. This is necessary so we can use reflection + // on any type in any assembly (because the type we are after will + // most likely not be in the current assembly and, worse, may be + // in an assembly that has not been loaded yet. (Type.GetType() + // is no good because it looks only in the calling object's assembly + // and mscorlib.dll.) + // + private static void loadAssemblies() + { + if(!_assembliesLoaded) // Lazy initialization + { + lock(_mutex) // MONO BUG: Should be WaitOne(), but that's broken under Mono 1.0 for Linux. + { + if(!_assembliesLoaded) // Double-checked locking + { + Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); + foreach(Assembly a in assemblies) + { + _loadedAssemblies[a.FullName] = a; + } + foreach(Assembly a in assemblies) + { + loadReferencedAssemblies(a); + } + _assembliesLoaded = true; + } + } + } + } + + private static void loadReferencedAssemblies(Assembly a) + { + AssemblyName[] names = a.GetReferencedAssemblies(); + foreach(AssemblyName name in names) + { + if(!_loadedAssemblies.Contains(name.FullName)) + { + Assembly ra = Assembly.Load(name); + _loadedAssemblies[ra.FullName] = ra; + loadReferencedAssemblies(ra); + } + } + } + private static volatile bool _assembliesLoaded = false; private static Hashtable _loadedAssemblies = new Hashtable(); // <string, Assembly> pairs. private static Hashtable _typeTable = new Hashtable(); // <type name, Type> pairs. diff --git a/cs/src/Ice/BasicStream.cs b/cs/src/Ice/BasicStream.cs index 55194a50d48..0d32a2ad2b2 100755 --- a/cs/src/Ice/BasicStream.cs +++ b/cs/src/Ice/BasicStream.cs @@ -1771,20 +1771,13 @@ namespace IceInternal private Type _class; } - private static Type findTypeForId(string id) - { - return AssemblyUtil.findType(typeToClass(id)); - } - private Ice.ObjectFactory loadObjectFactory(string id) { Ice.ObjectFactory factory = null; try { - AssemblyUtil.loadAssemblies(); // Lazy initialization - - Type c = findTypeForId(id); + Type c = AssemblyUtil.findType(typeToClass(id)); if(c == null) { return null; @@ -1864,36 +1857,31 @@ namespace IceInternal { UserExceptionFactory factory = null; - _exceptionFactoryMutex.WaitOne(); - factory = (UserExceptionFactory)_exceptionFactories[id]; - _exceptionFactoryMutex.ReleaseMutex(); - - if(factory == null) + lock(_exceptionFactories) { - try + factory = (UserExceptionFactory)_exceptionFactories[id]; + if(factory == null) { - AssemblyUtil.loadAssemblies(); // Lazy initialization - - Type c = findTypeForId(id); - if(c == null) + try + { + Type c = AssemblyUtil.findType(typeToClass(id)); + if(c == null) + { + return null; + } + // + // Ensure the class is instantiable. + // + Debug.Assert(!c.IsAbstract && !c.IsInterface); + factory = new DynamicUserExceptionFactory(c); + _exceptionFactories[id] = factory; + } + catch(Exception ex) { - return null; + throw new Ice.UnknownUserException(ex); } - // - // Ensure the class is instantiable. - // - Debug.Assert(!c.IsAbstract && !c.IsInterface); - factory = new DynamicUserExceptionFactory(c); - _exceptionFactoryMutex.WaitOne(); - _exceptionFactories[id] = factory; - _exceptionFactoryMutex.ReleaseMutex(); - } - catch(Exception ex) - { - throw new Ice.UnknownUserException(ex); } } - return factory; } @@ -1972,7 +1960,6 @@ namespace IceInternal private ArrayList _objectList; private static Hashtable _exceptionFactories = new Hashtable(); // <type name, factory> pairs. - private static Mutex _exceptionFactoryMutex = new Mutex(); private static volatile bool _bzlibInstalled; diff --git a/cs/src/Ice/ByteBuffer.cs b/cs/src/Ice/ByteBuffer.cs index 2dfa7d5d25d..b5c5c320d86 100755 --- a/cs/src/Ice/ByteBuffer.cs +++ b/cs/src/Ice/ByteBuffer.cs @@ -7,881 +7,881 @@ // // ********************************************************************** -using System;
-
-namespace IceInternal
-{
-
- public sealed class BufferManager
- {
- internal BufferManager()
- {
- _head = null;
- }
-
- internal ByteBuffer allocate(int size)
- {
- ByteBuffer buf = getBuffer(size);
- if(buf == null)
- {
- try
- {
- buf = ByteBuffer.allocate(size);
- }
- catch(System.OutOfMemoryException ex)
- {
- Ice.MemoryLimitException e = new Ice.MemoryLimitException(ex);
- throw e;
- }
- buf.order(ByteBuffer.ByteOrder.LITTLE_ENDIAN);
- }
- return buf;
- }
-
- internal ByteBuffer reallocate(ByteBuffer old, int size)
- {
- ByteBuffer buf = getBuffer(size);
- if(buf == null)
- {
- try
- {
- buf = ByteBuffer.allocate(size);
- }
- catch(System.OutOfMemoryException ex)
- {
- throw new Ice.MemoryLimitException(ex);
- }
- buf.order(ByteBuffer.ByteOrder.LITTLE_ENDIAN);
- }
- old.position(0);
- buf.put(old);
- reclaim(old);
- return buf;
- }
-
- internal void reclaim(ByteBuffer buf)
- {
- lock(this)
- {
- BufferNode node;
- if(_nodeCache == null)
- {
- node = new BufferNode();
- }
- else
- {
- node = _nodeCache;
- _nodeCache = _nodeCache.next;
- }
- node.buf = buf;
- node.capacity = buf.capacity();
- node.next = _head;
- _head = node;
- }
- }
-
- private ByteBuffer getBuffer(int size)
- {
- lock(this)
- {
- BufferNode node = _head;
- BufferNode prev = null;
- while(node != null)
- {
- if(size <= node.capacity)
- {
- break;
- }
- prev = node;
- node = node.next;
- }
- if(node != null)
- {
- if(prev != null)
- {
- prev.next = node.next;
- }
- else
- {
- _head = node.next;
- }
- node.next = _nodeCache;
- _nodeCache = node;
- node.buf.clear();
- return node.buf;
- }
- else
- {
- return null;
- }
- }
- }
-
- private sealed class BufferNode
- {
- internal ByteBuffer buf;
- internal int capacity;
- internal BufferNode next;
- }
-
- private BufferNode _head;
- private BufferNode _nodeCache;
- }
-
- public class ByteBuffer
- {
-
- public ByteBuffer()
- {
- _order = ByteOrder.BIG_ENDIAN;
- }
-
- public enum ByteOrder { BIG_ENDIAN, LITTLE_ENDIAN };
-
- public static ByteOrder nativeOrder()
- {
- return NO._o;
- }
-
- public ByteOrder order()
- {
- return _order;
- }
-
- public ByteBuffer order(ByteOrder bo)
- {
- _order = bo;
- return this;
- }
-
- public static ByteBuffer allocate(int capacity)
- {
- if(capacity < 0)
- {
- throw new ArgumentOutOfRangeException("capacity", capacity, "capacity must be non-negative");
- }
- ByteBuffer ret = new ByteBuffer();
- ret._position = 0;
- ret._limit = capacity;
- ret._capacity = capacity;
- ret._bytes = new byte[capacity];
- return ret;
- }
-
- public int position()
- {
- return _position;
- }
-
- public ByteBuffer position(int pos)
- {
- if(pos < 0)
- {
- throw new ArgumentOutOfRangeException("pos", pos, "position must be non-negative");
- }
- if(pos > _limit)
- {
- throw new ArgumentOutOfRangeException("pos", pos, "position must be less than limit");
- }
- _position = pos;
- return this;
- }
-
- public int limit()
- {
- return _limit;
- }
-
- public ByteBuffer limit(int newLimit)
- {
- if(newLimit < 0)
- {
- throw new ArgumentOutOfRangeException("newLimit", newLimit, "limit must be non-negative");
- }
- if(newLimit > _capacity)
- {
- throw new ArgumentOutOfRangeException("newLimit", newLimit, "limit must be less than capacity");
- }
- _limit = newLimit;
- return this;
- }
-
- public void clear()
- {
- _position = 0;
- _limit = _capacity;
- }
-
- public int remaining()
- {
- return _limit - _position;
- }
-
- public bool hasRemaining()
- {
- return _position < _limit;
- }
-
- public int capacity()
- {
- return _capacity;
- }
-
- public byte[] toArray()
- {
- int len = remaining();
- byte[] rc = new byte[len];
- Buffer.BlockCopy(_bytes, 0, rc, 0, len);
- return rc;
- }
-
- public ByteBuffer put(ByteBuffer buf)
- {
- int len = buf.remaining();
- checkOverflow(len);
- Buffer.BlockCopy(buf._bytes, buf._position, _bytes, _position, len);
- _position += len;
- return this;
- }
-
- public byte get()
- {
- checkUnderflow(1);
- return Buffer.GetByte(_bytes, _position++);
- }
-
- public ByteBuffer get(byte[] b)
- {
- return get(b, 0, Buffer.ByteLength(b));
- }
-
- public ByteBuffer get(byte[] b, int offset, int length)
- {
- if(offset < 0)
- {
- throw new ArgumentOutOfRangeException("offset", offset, "offset must be non-negative");
- }
- if(offset + length > Buffer.ByteLength(b))
- {
- throw new ArgumentOutOfRangeException("length", length,
- "insufficient room beyond given offset in destination array");
- }
- checkUnderflow(length);
- Buffer.BlockCopy(_bytes, _position, b, offset, length);
- _position += length;
- return this;
- }
-
- public ByteBuffer put(byte b)
- {
- checkOverflow(1);
- Buffer.SetByte(_bytes, _position++, b);
- return this;
- }
-
- public ByteBuffer put(byte[] b)
- {
- return put(b, 0, Buffer.ByteLength(b));
- }
-
- public ByteBuffer put(byte[]b, int offset, int length)
- {
- if(offset < 0)
- {
- throw new ArgumentOutOfRangeException("offset", offset, "offset must be non-negative");
- }
- if(offset + length > Buffer.ByteLength(b))
- {
- throw new ArgumentOutOfRangeException("length", length,
- "insufficient data beyond given offset in source array");
- }
- checkOverflow(length);
- Buffer.BlockCopy(b, offset, _bytes, _position, length);
- _position += length;
- return this;
- }
-
- public bool getBool()
- {
- return get() == 1;
- }
-
- public void getBoolSeq(bool[] seq)
- {
- int len = Buffer.ByteLength(seq);
- checkUnderflow(len);
- Buffer.BlockCopy(_bytes, _position, seq, 0, len);
- _position += len;
- }
-
- public ByteBuffer putBool(bool b)
- {
- return put(b ? (byte)1 : (byte)0);
- }
-
- public ByteBuffer putBoolSeq(bool[] seq)
- {
- int len = Buffer.ByteLength(seq);
- checkOverflow(len);
- Buffer.BlockCopy(seq, 0, _bytes, _position, len);
- _position += len;
- return this;
- }
-
- public unsafe short getShort()
- {
- checkUnderflow(2);
- short ret;
- if(NO._o == _order)
- {
- fixed(byte* p = &_bytes[_position])
- {
- ret = *((short*)p);
- }
- }
- else
- {
- byte* p = (byte*)&ret;
- *p++ = Buffer.GetByte(_bytes, _position + 1);
- *p = Buffer.GetByte(_bytes, _position);
- }
- _position += 2;
- return ret;
- }
-
- public unsafe void getShortSeq(short[] seq)
- {
- int len = Buffer.ByteLength(seq);
- checkUnderflow(len);
- if(NO._o == _order)
- {
- Buffer.BlockCopy(_bytes, _position, seq, 0, len);
- }
- else
- {
- for(int i = 0; i < seq.Length; ++i)
- {
- fixed(short* p = &seq[i])
- {
- int index = i * 2;
- byte* q = (byte*)p;
- *q++ = Buffer.GetByte(_bytes, index + 1);
- *q = Buffer.GetByte(_bytes, index);
- }
- }
- }
- _position += len;
- }
-
- public unsafe ByteBuffer putShort(short val)
- {
- checkOverflow(2);
- if(NO._o == _order)
- {
- fixed(byte* p = &_bytes[_position])
- {
- *((short*)p) = val;
- }
- _position += 2;
- }
- else
- {
- byte* p = (byte*)&val;
- Buffer.SetByte(_bytes, _position++, *(p + 1));
- Buffer.SetByte(_bytes, _position++, *p);
- }
- return this;
- }
-
- public unsafe ByteBuffer putShortSeq(short[] seq)
- {
- int len = Buffer.ByteLength(seq);
- checkOverflow(len);
- if(NO._o == _order)
- {
- Buffer.BlockCopy(seq, 0, _bytes, _position, len);
- _position += len;
- }
- else
- {
- for(int i = 0; i < seq.Length; ++i)
- {
- int index = i * 2;
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 1));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index));
- }
- }
- return this;
- }
-
- public unsafe int getInt()
- {
- checkUnderflow(4);
- int ret;
- if(NO._o == _order)
- {
- fixed(byte* p = &_bytes[_position])
- {
- ret = *((int*)p);
- }
- }
- else
- {
- byte* p = (byte*)&ret;
- *p++ = Buffer.GetByte(_bytes, _position + 3);
- *p++ = Buffer.GetByte(_bytes, _position + 2);
- *p++ = Buffer.GetByte(_bytes, _position + 1);
- *p = Buffer.GetByte(_bytes, _position);
- }
- _position += 4;
- return ret;
- }
-
- public unsafe void getIntSeq(int[] seq)
- {
- int len = Buffer.ByteLength(seq);
- checkUnderflow(len);
- if(NO._o == _order)
- {
- Buffer.BlockCopy(_bytes, _position, seq, 0, len);
- }
- else
- {
- for(int i = 0; i < seq.Length; ++i)
- {
- fixed(int* p = &seq[i])
- {
- int index = i * 4;
- byte* q = (byte*)p;
- *q++ = Buffer.GetByte(_bytes, index + 3);
- *q++ = Buffer.GetByte(_bytes, index + 2);
- *q++ = Buffer.GetByte(_bytes, index + 1);
- *q = Buffer.GetByte(_bytes, index);
- }
- }
- }
- _position += len;
- }
-
- public ByteBuffer putInt(int val)
- {
- putInt(_position, val);
- _position += 4;
- return this;
- }
-
- public unsafe ByteBuffer putInt(int pos, int val)
- {
- if(pos < 0)
- {
- throw new ArgumentOutOfRangeException("pos", pos, "position must be non-negative");
- }
- if(pos + 4 > _limit)
- {
- throw new ArgumentOutOfRangeException("pos", pos, "position must be less than limit - 4");
- }
- if(NO._o == _order)
- {
- fixed(byte* p = &_bytes[pos])
- {
- *((int*)p) = val;
- }
- }
- else
- {
- byte* p = (byte*)&val;
- Buffer.SetByte(_bytes, pos, *(p + 3));
- Buffer.SetByte(_bytes, pos + 1, *(p + 2));
- Buffer.SetByte(_bytes, pos + 2, *(p + 1));
- Buffer.SetByte(_bytes, pos + 3, *p);
- }
- return this;
- }
-
- public ByteBuffer putIntSeq(int[] seq)
- {
- int len = Buffer.ByteLength(seq);
- checkOverflow(len);
- if(NO._o == _order)
- {
- Buffer.BlockCopy(seq, 0, _bytes, _position, len);
- _position += len;
- }
- else
- {
- for(int i = 0; i < seq.Length; ++i)
- {
- int index = i * 4;
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 3));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 2));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 1));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index));
- }
- }
- return this;
- }
-
- public unsafe long getLong()
- {
- checkUnderflow(8);
- long ret;
- if(NO._o == _order)
- {
- fixed(byte* p = &_bytes[_position])
- {
- ret = *((long*)p);
- }
- }
- else
- {
- byte* p = (byte*)&ret;
- *p++ = Buffer.GetByte(_bytes, _position + 7);
- *p++ = Buffer.GetByte(_bytes, _position + 6);
- *p++ = Buffer.GetByte(_bytes, _position + 5);
- *p++ = Buffer.GetByte(_bytes, _position + 4);
- *p++ = Buffer.GetByte(_bytes, _position + 3);
- *p++ = Buffer.GetByte(_bytes, _position + 2);
- *p++ = Buffer.GetByte(_bytes, _position + 1);
- *p = Buffer.GetByte(_bytes, _position);
- }
- _position += 8;
- return ret;
- }
-
- public unsafe void getLongSeq(long[] seq)
- {
- int len = Buffer.ByteLength(seq);
- checkUnderflow(len);
- if(NO._o == _order)
- {
- Buffer.BlockCopy(_bytes, _position, seq, 0, len);
- }
- else
- {
- for(int i = 0; i < seq.Length; ++i)
- {
- fixed(long* p = &seq[i])
- {
- int index = i * 8;
- byte* q = (byte*)p;
- *q++ = Buffer.GetByte(_bytes, index + 7);
- *q++ = Buffer.GetByte(_bytes, index + 6);
- *q++ = Buffer.GetByte(_bytes, index + 5);
- *q++ = Buffer.GetByte(_bytes, index + 4);
- *q++ = Buffer.GetByte(_bytes, index + 3);
- *q++ = Buffer.GetByte(_bytes, index + 2);
- *q++ = Buffer.GetByte(_bytes, index + 1);
- *q = Buffer.GetByte(_bytes, index);
- }
- }
- }
- _position += len;
- }
-
- public unsafe ByteBuffer putLong(long val)
- {
- checkOverflow(8);
- if(NO._o == _order)
- {
- fixed(byte* p = &_bytes[_position])
- {
- *((long*)p) = val;
- }
- _position += 8;
- }
- else
- {
- byte* p = (byte*)&val;
- Buffer.SetByte(_bytes, _position++, *(p + 7));
- Buffer.SetByte(_bytes, _position++, *(p + 6));
- Buffer.SetByte(_bytes, _position++, *(p + 5));
- Buffer.SetByte(_bytes, _position++, *(p + 4));
- Buffer.SetByte(_bytes, _position++, *(p + 3));
- Buffer.SetByte(_bytes, _position++, *(p + 2));
- Buffer.SetByte(_bytes, _position++, *(p + 1));
- Buffer.SetByte(_bytes, _position++, *p);
- }
- return this;
- }
-
- public ByteBuffer putLongSeq(long[] seq)
- {
- int len = Buffer.ByteLength(seq);
- checkOverflow(len);
- if(NO._o == _order)
- {
- Buffer.BlockCopy(seq, 0, _bytes, _position, len);
- _position += len;
- }
- else
- {
- for(int i = 0; i < seq.Length; ++i)
- {
- int index = i * 8;
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 7));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 6));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 5));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 4));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 3));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 2));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 1));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index));
- }
- }
- return this;
- }
-
- public unsafe float getFloat()
- {
- checkUnderflow(4);
- float ret;
- if(NO._o == _order)
- {
- fixed(byte* p = &_bytes[_position])
- {
- ret = *((float*)p);
- }
- }
- else
- {
- byte* p = (byte*)&ret;
- *p++ = Buffer.GetByte(_bytes, _position + 3);
- *p++ = Buffer.GetByte(_bytes, _position + 2);
- *p++ = Buffer.GetByte(_bytes, _position + 1);
- *p = Buffer.GetByte(_bytes, _position);
- }
- _position += 4;
- return ret;
- }
-
- public unsafe void getFloatSeq(float[] seq)
- {
- int len = Buffer.ByteLength(seq);
- checkUnderflow(len);
- if(NO._o == _order)
- {
- Buffer.BlockCopy(_bytes, _position, seq, 0, len);
- }
- else
- {
- for(int i = 0; i < seq.Length; ++i)
- {
- fixed(float* p = &seq[i])
- {
- int index = i * 4;
- byte* q = (byte*)p;
- *q++ = Buffer.GetByte(_bytes, index + 3);
- *q++ = Buffer.GetByte(_bytes, index + 2);
- *q++ = Buffer.GetByte(_bytes, index + 1);
- *q = Buffer.GetByte(_bytes, index);
- }
- }
- }
- _position += len;
- }
-
- public unsafe ByteBuffer putFloat(float val)
- {
- checkOverflow(4);
- if(NO._o == _order)
- {
- fixed(byte* p = &_bytes[_position])
- {
- *((float*)p) = val;
- }
- _position += 4;
- }
- else
- {
- byte* p = (byte*)&val;
- Buffer.SetByte(_bytes, _position++, *(p + 3));
- Buffer.SetByte(_bytes, _position++, *(p + 2));
- Buffer.SetByte(_bytes, _position++, *(p + 1));
- Buffer.SetByte(_bytes, _position++, *p);
- }
- return this;
- }
-
- public ByteBuffer putFloatSeq(float[] seq)
- {
- int len = Buffer.ByteLength(seq);
- checkOverflow(len);
- if(NO._o == _order)
- {
- Buffer.BlockCopy(seq, 0, _bytes, _position, len);
- _position += len;
- }
- else
- {
- for(int i = 0; i < seq.Length; ++i)
- {
- int index = i * 4;
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 3));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 2));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 1));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index));
- }
- }
- return this;
- }
-
- public unsafe double getDouble()
- {
- checkUnderflow(8);
- double ret;
- if(NO._o == _order)
- {
- fixed(byte* p = &_bytes[_position])
- {
- ret = *((double*)p);
- }
- }
- else
- {
- byte* p = (byte*)&ret;
- *p++ = Buffer.GetByte(_bytes, _position + 7);
- *p++ = Buffer.GetByte(_bytes, _position + 6);
- *p++ = Buffer.GetByte(_bytes, _position + 5);
- *p++ = Buffer.GetByte(_bytes, _position + 4);
- *p++ = Buffer.GetByte(_bytes, _position + 3);
- *p++ = Buffer.GetByte(_bytes, _position + 2);
- *p++ = Buffer.GetByte(_bytes, _position + 1);
- *p = Buffer.GetByte(_bytes, _position);
- }
- _position += 8;
- return ret;
- }
-
- public unsafe void getDoubleSeq(double[] seq)
- {
- int len = Buffer.ByteLength(seq);
- checkUnderflow(len);
- if(NO._o == _order)
- {
- Buffer.BlockCopy(_bytes, _position, seq, 0, len);
- }
- else
- {
- for(int i = 0; i < seq.Length; ++i)
- {
- fixed(double* p = &seq[i])
- {
- int index = i * 8;
- byte* q = (byte*)p;
- *q++ = Buffer.GetByte(_bytes, index + 7);
- *q++ = Buffer.GetByte(_bytes, index + 6);
- *q++ = Buffer.GetByte(_bytes, index + 5);
- *q++ = Buffer.GetByte(_bytes, index + 4);
- *q++ = Buffer.GetByte(_bytes, index + 3);
- *q++ = Buffer.GetByte(_bytes, index + 2);
- *q++ = Buffer.GetByte(_bytes, index + 1);
- *q = Buffer.GetByte(_bytes, index);
- }
- }
- }
- _position += len;
- }
-
- public unsafe ByteBuffer putDouble(double val)
- {
- checkOverflow(8);
- if(NO._o == _order)
- {
- fixed(byte* p = &_bytes[_position])
- {
- *((double*)p) = val;
- }
- _position += 8;
- }
- else
- {
- byte* p = (byte*)&val;
- Buffer.SetByte(_bytes, _position++, *(p + 7));
- Buffer.SetByte(_bytes, _position++, *(p + 6));
- Buffer.SetByte(_bytes, _position++, *(p + 5));
- Buffer.SetByte(_bytes, _position++, *(p + 4));
- Buffer.SetByte(_bytes, _position++, *(p + 3));
- Buffer.SetByte(_bytes, _position++, *(p + 2));
- Buffer.SetByte(_bytes, _position++, *(p + 1));
- Buffer.SetByte(_bytes, _position++, *p);
- }
- return this;
- }
-
- public ByteBuffer putDoubleSeq(double[] seq)
- {
- int len = Buffer.ByteLength(seq);
- checkOverflow(len);
- if(NO._o == _order)
- {
- Buffer.BlockCopy(seq, 0, _bytes, _position, len);
- _position += len;
- }
- else
- {
- for(int i = 0; i < seq.Length; ++i)
- {
- int index = i * 8;
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 7));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 6));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 5));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 4));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 3));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 2));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 1));
- Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index));
- }
- }
- return this;
- }
-
- internal byte[] rawBytes()
- {
- return _bytes;
- }
-
- internal byte[] rawBytes(int offset, int len)
- {
- if(offset + len > _limit)
- {
- throw new InvalidOperationException("buffer underflow");
- }
- byte[] rc = new byte[len];
- Array.Copy(_bytes, offset, rc, 0, len);
- return rc;
- }
-
- private void checkUnderflow(int size)
- {
- if(_position + size > _limit)
- {
- throw new InvalidOperationException("buffer underflow");
- }
- }
-
- private void checkOverflow(int size)
- {
- if(_position + size > _limit)
- {
- throw new InvalidOperationException("buffer overflow");
- }
- }
-
- private int _position;
- private int _limit;
- private int _capacity;
- private byte[] _bytes;
- private ByteOrder _order;
-
- private class NO // Native Order
- {
- static NO()
- {
- byte[] b = BitConverter.GetBytes((int)1);
- _o = b[0] == 1 ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN;
- }
- internal static readonly ByteOrder _o;
- }
- }
-
-}
+using System; + +namespace IceInternal +{ + + public sealed class BufferManager + { + internal BufferManager() + { + _head = null; + } + + internal ByteBuffer allocate(int size) + { + ByteBuffer buf = getBuffer(size); + if(buf == null) + { + try + { + buf = ByteBuffer.allocate(size); + } + catch(System.OutOfMemoryException ex) + { + Ice.MemoryLimitException e = new Ice.MemoryLimitException(ex); + throw e; + } + buf.order(ByteBuffer.ByteOrder.LITTLE_ENDIAN); + } + return buf; + } + + internal ByteBuffer reallocate(ByteBuffer old, int size) + { + ByteBuffer buf = getBuffer(size); + if(buf == null) + { + try + { + buf = ByteBuffer.allocate(size); + } + catch(System.OutOfMemoryException ex) + { + throw new Ice.MemoryLimitException(ex); + } + buf.order(ByteBuffer.ByteOrder.LITTLE_ENDIAN); + } + old.position(0); + buf.put(old); + reclaim(old); + return buf; + } + + internal void reclaim(ByteBuffer buf) + { + lock(this) + { + BufferNode node; + if(_nodeCache == null) + { + node = new BufferNode(); + } + else + { + node = _nodeCache; + _nodeCache = _nodeCache.next; + } + node.buf = buf; + node.capacity = buf.capacity(); + node.next = _head; + _head = node; + } + } + + private ByteBuffer getBuffer(int size) + { + lock(this) + { + BufferNode node = _head; + BufferNode prev = null; + while(node != null) + { + if(size <= node.capacity) + { + break; + } + prev = node; + node = node.next; + } + if(node != null) + { + if(prev != null) + { + prev.next = node.next; + } + else + { + _head = node.next; + } + node.next = _nodeCache; + _nodeCache = node; + node.buf.clear(); + return node.buf; + } + else + { + return null; + } + } + } + + private sealed class BufferNode + { + internal ByteBuffer buf; + internal int capacity; + internal BufferNode next; + } + + private BufferNode _head; + private BufferNode _nodeCache; + } + + public class ByteBuffer + { + + public ByteBuffer() + { + _order = ByteOrder.BIG_ENDIAN; + } + + public enum ByteOrder { BIG_ENDIAN, LITTLE_ENDIAN }; + + public static ByteOrder nativeOrder() + { + return NO._o; + } + + public ByteOrder order() + { + return _order; + } + + public ByteBuffer order(ByteOrder bo) + { + _order = bo; + return this; + } + + public static ByteBuffer allocate(int capacity) + { + if(capacity < 0) + { + throw new ArgumentOutOfRangeException("capacity", capacity, "capacity must be non-negative"); + } + ByteBuffer ret = new ByteBuffer(); + ret._position = 0; + ret._limit = capacity; + ret._capacity = capacity; + ret._bytes = new byte[capacity]; + return ret; + } + + public int position() + { + return _position; + } + + public ByteBuffer position(int pos) + { + if(pos < 0) + { + throw new ArgumentOutOfRangeException("pos", pos, "position must be non-negative"); + } + if(pos > _limit) + { + throw new ArgumentOutOfRangeException("pos", pos, "position must be less than limit"); + } + _position = pos; + return this; + } + + public int limit() + { + return _limit; + } + + public ByteBuffer limit(int newLimit) + { + if(newLimit < 0) + { + throw new ArgumentOutOfRangeException("newLimit", newLimit, "limit must be non-negative"); + } + if(newLimit > _capacity) + { + throw new ArgumentOutOfRangeException("newLimit", newLimit, "limit must be less than capacity"); + } + _limit = newLimit; + return this; + } + + public void clear() + { + _position = 0; + _limit = _capacity; + } + + public int remaining() + { + return _limit - _position; + } + + public bool hasRemaining() + { + return _position < _limit; + } + + public int capacity() + { + return _capacity; + } + + public byte[] toArray() + { + int len = remaining(); + byte[] rc = new byte[len]; + Buffer.BlockCopy(_bytes, 0, rc, 0, len); + return rc; + } + + public ByteBuffer put(ByteBuffer buf) + { + int len = buf.remaining(); + checkOverflow(len); + Buffer.BlockCopy(buf._bytes, buf._position, _bytes, _position, len); + _position += len; + return this; + } + + public byte get() + { + checkUnderflow(1); + return Buffer.GetByte(_bytes, _position++); + } + + public ByteBuffer get(byte[] b) + { + return get(b, 0, Buffer.ByteLength(b)); + } + + public ByteBuffer get(byte[] b, int offset, int length) + { + if(offset < 0) + { + throw new ArgumentOutOfRangeException("offset", offset, "offset must be non-negative"); + } + if(offset + length > Buffer.ByteLength(b)) + { + throw new ArgumentOutOfRangeException("length", length, + "insufficient room beyond given offset in destination array"); + } + checkUnderflow(length); + Buffer.BlockCopy(_bytes, _position, b, offset, length); + _position += length; + return this; + } + + public ByteBuffer put(byte b) + { + checkOverflow(1); + Buffer.SetByte(_bytes, _position++, b); + return this; + } + + public ByteBuffer put(byte[] b) + { + return put(b, 0, Buffer.ByteLength(b)); + } + + public ByteBuffer put(byte[]b, int offset, int length) + { + if(offset < 0) + { + throw new ArgumentOutOfRangeException("offset", offset, "offset must be non-negative"); + } + if(offset + length > Buffer.ByteLength(b)) + { + throw new ArgumentOutOfRangeException("length", length, + "insufficient data beyond given offset in source array"); + } + checkOverflow(length); + Buffer.BlockCopy(b, offset, _bytes, _position, length); + _position += length; + return this; + } + + public bool getBool() + { + return get() == 1; + } + + public void getBoolSeq(bool[] seq) + { + int len = Buffer.ByteLength(seq); + checkUnderflow(len); + Buffer.BlockCopy(_bytes, _position, seq, 0, len); + _position += len; + } + + public ByteBuffer putBool(bool b) + { + return put(b ? (byte)1 : (byte)0); + } + + public ByteBuffer putBoolSeq(bool[] seq) + { + int len = Buffer.ByteLength(seq); + checkOverflow(len); + Buffer.BlockCopy(seq, 0, _bytes, _position, len); + _position += len; + return this; + } + + public unsafe short getShort() + { + checkUnderflow(2); + short ret; + if(NO._o == _order) + { + fixed(byte* p = &_bytes[_position]) + { + ret = *((short*)p); + } + } + else + { + byte* p = (byte*)&ret; + *p++ = Buffer.GetByte(_bytes, _position + 1); + *p = Buffer.GetByte(_bytes, _position); + } + _position += 2; + return ret; + } + + public unsafe void getShortSeq(short[] seq) + { + int len = Buffer.ByteLength(seq); + checkUnderflow(len); + if(NO._o == _order) + { + Buffer.BlockCopy(_bytes, _position, seq, 0, len); + } + else + { + for(int i = 0; i < seq.Length; ++i) + { + fixed(short* p = &seq[i]) + { + int index = i * 2; + byte* q = (byte*)p; + *q++ = Buffer.GetByte(_bytes, index + 1); + *q = Buffer.GetByte(_bytes, index); + } + } + } + _position += len; + } + + public unsafe ByteBuffer putShort(short val) + { + checkOverflow(2); + if(NO._o == _order) + { + fixed(byte* p = &_bytes[_position]) + { + *((short*)p) = val; + } + _position += 2; + } + else + { + byte* p = (byte*)&val; + Buffer.SetByte(_bytes, _position++, *(p + 1)); + Buffer.SetByte(_bytes, _position++, *p); + } + return this; + } + + public unsafe ByteBuffer putShortSeq(short[] seq) + { + int len = Buffer.ByteLength(seq); + checkOverflow(len); + if(NO._o == _order) + { + Buffer.BlockCopy(seq, 0, _bytes, _position, len); + _position += len; + } + else + { + for(int i = 0; i < seq.Length; ++i) + { + int index = i * 2; + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 1)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index)); + } + } + return this; + } + + public unsafe int getInt() + { + checkUnderflow(4); + int ret; + if(NO._o == _order) + { + fixed(byte* p = &_bytes[_position]) + { + ret = *((int*)p); + } + } + else + { + byte* p = (byte*)&ret; + *p++ = Buffer.GetByte(_bytes, _position + 3); + *p++ = Buffer.GetByte(_bytes, _position + 2); + *p++ = Buffer.GetByte(_bytes, _position + 1); + *p = Buffer.GetByte(_bytes, _position); + } + _position += 4; + return ret; + } + + public unsafe void getIntSeq(int[] seq) + { + int len = Buffer.ByteLength(seq); + checkUnderflow(len); + if(NO._o == _order) + { + Buffer.BlockCopy(_bytes, _position, seq, 0, len); + } + else + { + for(int i = 0; i < seq.Length; ++i) + { + fixed(int* p = &seq[i]) + { + int index = i * 4; + byte* q = (byte*)p; + *q++ = Buffer.GetByte(_bytes, index + 3); + *q++ = Buffer.GetByte(_bytes, index + 2); + *q++ = Buffer.GetByte(_bytes, index + 1); + *q = Buffer.GetByte(_bytes, index); + } + } + } + _position += len; + } + + public ByteBuffer putInt(int val) + { + putInt(_position, val); + _position += 4; + return this; + } + + public unsafe ByteBuffer putInt(int pos, int val) + { + if(pos < 0) + { + throw new ArgumentOutOfRangeException("pos", pos, "position must be non-negative"); + } + if(pos + 4 > _limit) + { + throw new ArgumentOutOfRangeException("pos", pos, "position must be less than limit - 4"); + } + if(NO._o == _order) + { + fixed(byte* p = &_bytes[pos]) + { + *((int*)p) = val; + } + } + else + { + byte* p = (byte*)&val; + Buffer.SetByte(_bytes, pos, *(p + 3)); + Buffer.SetByte(_bytes, pos + 1, *(p + 2)); + Buffer.SetByte(_bytes, pos + 2, *(p + 1)); + Buffer.SetByte(_bytes, pos + 3, *p); + } + return this; + } + + public ByteBuffer putIntSeq(int[] seq) + { + int len = Buffer.ByteLength(seq); + checkOverflow(len); + if(NO._o == _order) + { + Buffer.BlockCopy(seq, 0, _bytes, _position, len); + _position += len; + } + else + { + for(int i = 0; i < seq.Length; ++i) + { + int index = i * 4; + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 3)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 2)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 1)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index)); + } + } + return this; + } + + public unsafe long getLong() + { + checkUnderflow(8); + long ret; + if(NO._o == _order) + { + fixed(byte* p = &_bytes[_position]) + { + ret = *((long*)p); + } + } + else + { + byte* p = (byte*)&ret; + *p++ = Buffer.GetByte(_bytes, _position + 7); + *p++ = Buffer.GetByte(_bytes, _position + 6); + *p++ = Buffer.GetByte(_bytes, _position + 5); + *p++ = Buffer.GetByte(_bytes, _position + 4); + *p++ = Buffer.GetByte(_bytes, _position + 3); + *p++ = Buffer.GetByte(_bytes, _position + 2); + *p++ = Buffer.GetByte(_bytes, _position + 1); + *p = Buffer.GetByte(_bytes, _position); + } + _position += 8; + return ret; + } + + public unsafe void getLongSeq(long[] seq) + { + int len = Buffer.ByteLength(seq); + checkUnderflow(len); + if(NO._o == _order) + { + Buffer.BlockCopy(_bytes, _position, seq, 0, len); + } + else + { + for(int i = 0; i < seq.Length; ++i) + { + fixed(long* p = &seq[i]) + { + int index = i * 8; + byte* q = (byte*)p; + *q++ = Buffer.GetByte(_bytes, index + 7); + *q++ = Buffer.GetByte(_bytes, index + 6); + *q++ = Buffer.GetByte(_bytes, index + 5); + *q++ = Buffer.GetByte(_bytes, index + 4); + *q++ = Buffer.GetByte(_bytes, index + 3); + *q++ = Buffer.GetByte(_bytes, index + 2); + *q++ = Buffer.GetByte(_bytes, index + 1); + *q = Buffer.GetByte(_bytes, index); + } + } + } + _position += len; + } + + public unsafe ByteBuffer putLong(long val) + { + checkOverflow(8); + if(NO._o == _order) + { + fixed(byte* p = &_bytes[_position]) + { + *((long*)p) = val; + } + _position += 8; + } + else + { + byte* p = (byte*)&val; + Buffer.SetByte(_bytes, _position++, *(p + 7)); + Buffer.SetByte(_bytes, _position++, *(p + 6)); + Buffer.SetByte(_bytes, _position++, *(p + 5)); + Buffer.SetByte(_bytes, _position++, *(p + 4)); + Buffer.SetByte(_bytes, _position++, *(p + 3)); + Buffer.SetByte(_bytes, _position++, *(p + 2)); + Buffer.SetByte(_bytes, _position++, *(p + 1)); + Buffer.SetByte(_bytes, _position++, *p); + } + return this; + } + + public ByteBuffer putLongSeq(long[] seq) + { + int len = Buffer.ByteLength(seq); + checkOverflow(len); + if(NO._o == _order) + { + Buffer.BlockCopy(seq, 0, _bytes, _position, len); + _position += len; + } + else + { + for(int i = 0; i < seq.Length; ++i) + { + int index = i * 8; + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 7)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 6)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 5)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 4)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 3)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 2)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 1)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index)); + } + } + return this; + } + + public unsafe float getFloat() + { + checkUnderflow(4); + float ret; + if(NO._o == _order) + { + fixed(byte* p = &_bytes[_position]) + { + ret = *((float*)p); + } + } + else + { + byte* p = (byte*)&ret; + *p++ = Buffer.GetByte(_bytes, _position + 3); + *p++ = Buffer.GetByte(_bytes, _position + 2); + *p++ = Buffer.GetByte(_bytes, _position + 1); + *p = Buffer.GetByte(_bytes, _position); + } + _position += 4; + return ret; + } + + public unsafe void getFloatSeq(float[] seq) + { + int len = Buffer.ByteLength(seq); + checkUnderflow(len); + if(NO._o == _order) + { + Buffer.BlockCopy(_bytes, _position, seq, 0, len); + } + else + { + for(int i = 0; i < seq.Length; ++i) + { + fixed(float* p = &seq[i]) + { + int index = i * 4; + byte* q = (byte*)p; + *q++ = Buffer.GetByte(_bytes, index + 3); + *q++ = Buffer.GetByte(_bytes, index + 2); + *q++ = Buffer.GetByte(_bytes, index + 1); + *q = Buffer.GetByte(_bytes, index); + } + } + } + _position += len; + } + + public unsafe ByteBuffer putFloat(float val) + { + checkOverflow(4); + if(NO._o == _order) + { + fixed(byte* p = &_bytes[_position]) + { + *((float*)p) = val; + } + _position += 4; + } + else + { + byte* p = (byte*)&val; + Buffer.SetByte(_bytes, _position++, *(p + 3)); + Buffer.SetByte(_bytes, _position++, *(p + 2)); + Buffer.SetByte(_bytes, _position++, *(p + 1)); + Buffer.SetByte(_bytes, _position++, *p); + } + return this; + } + + public ByteBuffer putFloatSeq(float[] seq) + { + int len = Buffer.ByteLength(seq); + checkOverflow(len); + if(NO._o == _order) + { + Buffer.BlockCopy(seq, 0, _bytes, _position, len); + _position += len; + } + else + { + for(int i = 0; i < seq.Length; ++i) + { + int index = i * 4; + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 3)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 2)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 1)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index)); + } + } + return this; + } + + public unsafe double getDouble() + { + checkUnderflow(8); + double ret; + if(NO._o == _order) + { + fixed(byte* p = &_bytes[_position]) + { + ret = *((double*)p); + } + } + else + { + byte* p = (byte*)&ret; + *p++ = Buffer.GetByte(_bytes, _position + 7); + *p++ = Buffer.GetByte(_bytes, _position + 6); + *p++ = Buffer.GetByte(_bytes, _position + 5); + *p++ = Buffer.GetByte(_bytes, _position + 4); + *p++ = Buffer.GetByte(_bytes, _position + 3); + *p++ = Buffer.GetByte(_bytes, _position + 2); + *p++ = Buffer.GetByte(_bytes, _position + 1); + *p = Buffer.GetByte(_bytes, _position); + } + _position += 8; + return ret; + } + + public unsafe void getDoubleSeq(double[] seq) + { + int len = Buffer.ByteLength(seq); + checkUnderflow(len); + if(NO._o == _order) + { + Buffer.BlockCopy(_bytes, _position, seq, 0, len); + } + else + { + for(int i = 0; i < seq.Length; ++i) + { + fixed(double* p = &seq[i]) + { + int index = i * 8; + byte* q = (byte*)p; + *q++ = Buffer.GetByte(_bytes, index + 7); + *q++ = Buffer.GetByte(_bytes, index + 6); + *q++ = Buffer.GetByte(_bytes, index + 5); + *q++ = Buffer.GetByte(_bytes, index + 4); + *q++ = Buffer.GetByte(_bytes, index + 3); + *q++ = Buffer.GetByte(_bytes, index + 2); + *q++ = Buffer.GetByte(_bytes, index + 1); + *q = Buffer.GetByte(_bytes, index); + } + } + } + _position += len; + } + + public unsafe ByteBuffer putDouble(double val) + { + checkOverflow(8); + if(NO._o == _order) + { + fixed(byte* p = &_bytes[_position]) + { + *((double*)p) = val; + } + _position += 8; + } + else + { + byte* p = (byte*)&val; + Buffer.SetByte(_bytes, _position++, *(p + 7)); + Buffer.SetByte(_bytes, _position++, *(p + 6)); + Buffer.SetByte(_bytes, _position++, *(p + 5)); + Buffer.SetByte(_bytes, _position++, *(p + 4)); + Buffer.SetByte(_bytes, _position++, *(p + 3)); + Buffer.SetByte(_bytes, _position++, *(p + 2)); + Buffer.SetByte(_bytes, _position++, *(p + 1)); + Buffer.SetByte(_bytes, _position++, *p); + } + return this; + } + + public ByteBuffer putDoubleSeq(double[] seq) + { + int len = Buffer.ByteLength(seq); + checkOverflow(len); + if(NO._o == _order) + { + Buffer.BlockCopy(seq, 0, _bytes, _position, len); + _position += len; + } + else + { + for(int i = 0; i < seq.Length; ++i) + { + int index = i * 8; + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 7)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 6)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 5)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 4)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 3)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 2)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index + 1)); + Buffer.SetByte(_bytes, _position++, Buffer.GetByte(seq, index)); + } + } + return this; + } + + internal byte[] rawBytes() + { + return _bytes; + } + + internal byte[] rawBytes(int offset, int len) + { + if(offset + len > _limit) + { + throw new InvalidOperationException("buffer underflow"); + } + byte[] rc = new byte[len]; + Array.Copy(_bytes, offset, rc, 0, len); + return rc; + } + + private void checkUnderflow(int size) + { + if(_position + size > _limit) + { + throw new InvalidOperationException("buffer underflow"); + } + } + + private void checkOverflow(int size) + { + if(_position + size > _limit) + { + throw new InvalidOperationException("buffer overflow"); + } + } + + private int _position; + private int _limit; + private int _capacity; + private byte[] _bytes; + private ByteOrder _order; + + private class NO // Native Order + { + static NO() + { + byte[] b = BitConverter.GetBytes((int)1); + _o = b[0] == 1 ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN; + } + internal static readonly ByteOrder _o; + } + } + +} diff --git a/cs/src/Ice/ConnectionFactory.cs b/cs/src/Ice/ConnectionFactory.cs index b86d90d0e6a..8bafdba81c8 100644 --- a/cs/src/Ice/ConnectionFactory.cs +++ b/cs/src/Ice/ConnectionFactory.cs @@ -583,15 +583,15 @@ namespace IceInternal endpoints[j] = endpoints[j].timeout(defaultsAndOverrides.overrideTimeoutValue); } - //
- // The Connection object does not take the compression flag of
- // endpoints into account, but instead gets the information
- // about whether messages should be compressed or not from
- // other sources. In order to allow connection sharing for
- // endpoints that differ in the value of the compression flag
- // only, we always set the compression flag to false here in
- // this connection factory.
- //
+ // + // The Connection object does not take the compression flag of + // endpoints into account, but instead gets the information + // about whether messages should be compressed or not from + // other sources. In order to allow connection sharing for + // endpoints that differ in the value of the compression flag + // only, we always set the compression flag to false here in + // this connection factory. + // endpoints[j] = endpoints[j].compress(false); } @@ -605,9 +605,9 @@ namespace IceInternal { foreach(Connection connection in connectionList) { - //
- // Don't return connections for which destruction has
- // been initiated.
+ // + // Don't return connections for which destruction has + // been initiated. // if(!connection.isDestroyed()) { @@ -671,9 +671,9 @@ namespace IceInternal { foreach(Connection connection in connectionList) { - //
- // Don't return connections for which destruction has
- // been initiated.
+ // + // Don't return connections for which destruction has + // been initiated. // if(!connection.isDestroyed()) { @@ -844,15 +844,15 @@ namespace IceInternal endpoint = endpoint.timeout(defaultsAndOverrides.overrideTimeoutValue); } - //
- // The Connection object does not take the compression flag of
- // endpoints into account, but instead gets the information
- // about whether messages should be compressed or not from
- // other sources. In order to allow connection sharing for
- // endpoints that differ in the value of the compression flag
- // only, we always set the compression flag to false here in
- // this connection factory.
- //
+ // + // The Connection object does not take the compression flag of + // endpoints into account, but instead gets the information + // about whether messages should be compressed or not from + // other sources. In order to allow connection sharing for + // endpoints that differ in the value of the compression flag + // only, we always set the compression flag to false here in + // this connection factory. + // endpoint = endpoint.compress(false); LinkedList connectionList = (LinkedList)_connections[endpoints[i]]; diff --git a/cs/src/Ice/Endpoint.cs b/cs/src/Ice/Endpoint.cs index 5ee4de6a74a..48d9659b55d 100755 --- a/cs/src/Ice/Endpoint.cs +++ b/cs/src/Ice/Endpoint.cs @@ -7,104 +7,104 @@ // // ********************************************************************** -
-namespace IceInternal
-{
-
- public interface Endpoint : System.IComparable
- {
- //
- // Marshal the endpoint.
- //
- void streamWrite(BasicStream s);
-
- //
- // Convert the endpoint to its string form.
- //
- string ToString();
-
- //
- // Return the endpoint type.
- //
- short type();
-
- //
- // Return the timeout for the endpoint in milliseconds. 0 means
- // non-blocking, -1 means no timeout.
- //
- int timeout();
-
- //
- // Return a new endpoint with a different timeout value, provided
- // that timeouts are supported by the endpoint. Otherwise the same
- // endpoint is returned.
- //
- Endpoint timeout(int t);
-
- //
- // Return true if the endpoints support bzip2 compress, or false
- // otherwise.
- //
- bool compress();
-
- //
- // Return a new endpoint with a different compression value,
- // provided that compression is supported by the
- // endpoint. Otherwise the same endpoint is returned.
- //
- Endpoint compress(bool co);
-
- //
- // Return true if the endpoint is datagram-based.
- //
- bool datagram();
-
- //
- // Return true if the endpoint is secure.
- //
- bool secure();
-
- //
- // Return true if the endpoint type is unknown.
- //
- bool unknown();
-
- //
- // Return a client side transceiver for this endpoint, or null if a
- // transceiver can only be created by a connector.
- //
- Transceiver clientTransceiver();
-
- //
- // Return a server side transceiver for this endpoint, or null if a
- // transceiver can only be created by an acceptor. In case a
- // transceiver is created, this operation also returns a new
- // "effective" endpoint, which might differ from this endpoint,
- // for example, if a dynamic port number is assigned.
- //
- Transceiver serverTransceiver(ref Endpoint endpoint);
-
- //
- // Return a connector for this endpoint, or null if no connector
- // is available.
- //
- Connector connector();
-
- //
- // Return an acceptor for this endpoint, or null if no acceptors
- // is available. In case an acceptor is created, this operation
- // also returns a new "effective" endpoint, which might differ
- // from this endpoint, for example, if a dynamic port number is
- // assigned.
- //
- Acceptor acceptor(ref Endpoint endpoint);
-
- //
- // Check whether the endpoint is equivalent to a specific
- // Transceiver or Acceptor.
- //
- bool equivalent(Transceiver transceiver);
- bool equivalent(Acceptor acceptor);
- }
-
-}
+ +namespace IceInternal +{ + + public interface Endpoint : System.IComparable + { + // + // Marshal the endpoint. + // + void streamWrite(BasicStream s); + + // + // Convert the endpoint to its string form. + // + string ToString(); + + // + // Return the endpoint type. + // + short type(); + + // + // Return the timeout for the endpoint in milliseconds. 0 means + // non-blocking, -1 means no timeout. + // + int timeout(); + + // + // Return a new endpoint with a different timeout value, provided + // that timeouts are supported by the endpoint. Otherwise the same + // endpoint is returned. + // + Endpoint timeout(int t); + + // + // Return true if the endpoints support bzip2 compress, or false + // otherwise. + // + bool compress(); + + // + // Return a new endpoint with a different compression value, + // provided that compression is supported by the + // endpoint. Otherwise the same endpoint is returned. + // + Endpoint compress(bool co); + + // + // Return true if the endpoint is datagram-based. + // + bool datagram(); + + // + // Return true if the endpoint is secure. + // + bool secure(); + + // + // Return true if the endpoint type is unknown. + // + bool unknown(); + + // + // Return a client side transceiver for this endpoint, or null if a + // transceiver can only be created by a connector. + // + Transceiver clientTransceiver(); + + // + // Return a server side transceiver for this endpoint, or null if a + // transceiver can only be created by an acceptor. In case a + // transceiver is created, this operation also returns a new + // "effective" endpoint, which might differ from this endpoint, + // for example, if a dynamic port number is assigned. + // + Transceiver serverTransceiver(ref Endpoint endpoint); + + // + // Return a connector for this endpoint, or null if no connector + // is available. + // + Connector connector(); + + // + // Return an acceptor for this endpoint, or null if no acceptors + // is available. In case an acceptor is created, this operation + // also returns a new "effective" endpoint, which might differ + // from this endpoint, for example, if a dynamic port number is + // assigned. + // + Acceptor acceptor(ref Endpoint endpoint); + + // + // Check whether the endpoint is equivalent to a specific + // Transceiver or Acceptor. + // + bool equivalent(Transceiver transceiver); + bool equivalent(Acceptor acceptor); + } + +} diff --git a/cs/src/Ice/EndpointFactory.cs b/cs/src/Ice/EndpointFactory.cs index 085f198bc96..0f17981fe97 100755 --- a/cs/src/Ice/EndpointFactory.cs +++ b/cs/src/Ice/EndpointFactory.cs @@ -7,17 +7,17 @@ // // ********************************************************************** -
-namespace IceInternal
-{
-
- public interface EndpointFactory
- {
- short type();
- string protocol();
- Endpoint create(string str);
- Endpoint read(BasicStream s);
- void destroy();
- }
-
-}
+ +namespace IceInternal +{ + + public interface EndpointFactory + { + short type(); + string protocol(); + Endpoint create(string str); + Endpoint read(BasicStream s); + void destroy(); + } + +} diff --git a/cs/src/Ice/EndpointFactoryManager.cs b/cs/src/Ice/EndpointFactoryManager.cs index 935c5bf429b..e4d3f32d17d 100755 --- a/cs/src/Ice/EndpointFactoryManager.cs +++ b/cs/src/Ice/EndpointFactoryManager.cs @@ -7,123 +7,123 @@ // // ********************************************************************** -
-namespace IceInternal
-{
-
- using System.Collections;
- using System.Diagnostics;
- using System.Text.RegularExpressions;
-
- public sealed class EndpointFactoryManager
- {
- internal EndpointFactoryManager(Instance instance)
- {
- _instance = instance;
- _factories = new ArrayList();
- }
-
- public void add(EndpointFactory factory)
- {
- lock(this)
- {
- for(int i = 0; i < _factories.Count; i++)
- {
- EndpointFactory f = (EndpointFactory)_factories[i];
- if(f.type() == factory.type())
- {
- Debug.Assert(false);
- }
- }
- _factories.Add(factory);
- }
- }
-
- public EndpointFactory get(short type)
- {
- lock(this)
- {
- for(int i = 0; i < _factories.Count; i++)
- {
- EndpointFactory f = (EndpointFactory)_factories[i];
- if(f.type() == type)
- {
- return f;
- }
- }
- return null;
- }
- }
-
- public Endpoint create(string str)
- {
- lock(this)
- {
- string s = str.Trim();
- if(s.Length == 0)
- {
- Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = str;
- throw e;
- }
-
- Regex p = new Regex("([ \t\n\r]+)|$");
- Match m = p.Match(s);
- Debug.Assert(m.Success);
-
- string protocol = s.Substring(0, m.Index);
-
- if(protocol.Equals("default"))
- {
- protocol = _instance.defaultsAndOverrides().defaultProtocol;
- }
-
- for(int i = 0; i < _factories.Count; i++)
- {
- EndpointFactory f = (EndpointFactory)_factories[i];
- if(f.protocol().Equals(protocol))
- {
- return f.create(s.Substring(m.Index + m.Length));
- }
- }
-
- Ice.EndpointParseException e2 = new Ice.EndpointParseException();
- e2.str = str;
- throw e2;
- }
- }
-
- public Endpoint read(BasicStream s)
- {
- lock(this)
- {
- short type = s.readShort();
-
- for(int i = 0; i < _factories.Count; i++)
- {
- EndpointFactory f = (EndpointFactory)_factories[i];
- if(f.type() == type)
- {
- return f.read(s);
- }
- }
-
- return new UnknownEndpoint(type, s);
- }
- }
-
- internal void destroy()
- {
- for(int i = 0; i < _factories.Count; i++)
- {
- EndpointFactory f = (EndpointFactory)_factories[i];
- f.destroy();
- }
- _factories.Clear();
- }
-
- private readonly Instance _instance;
- private readonly ArrayList _factories;
- }
-
-}
+ +namespace IceInternal +{ + + using System.Collections; + using System.Diagnostics; + using System.Text.RegularExpressions; + + public sealed class EndpointFactoryManager + { + internal EndpointFactoryManager(Instance instance) + { + _instance = instance; + _factories = new ArrayList(); + } + + public void add(EndpointFactory factory) + { + lock(this) + { + for(int i = 0; i < _factories.Count; i++) + { + EndpointFactory f = (EndpointFactory)_factories[i]; + if(f.type() == factory.type()) + { + Debug.Assert(false); + } + } + _factories.Add(factory); + } + } + + public EndpointFactory get(short type) + { + lock(this) + { + for(int i = 0; i < _factories.Count; i++) + { + EndpointFactory f = (EndpointFactory)_factories[i]; + if(f.type() == type) + { + return f; + } + } + return null; + } + } + + public Endpoint create(string str) + { + lock(this) + { + string s = str.Trim(); + if(s.Length == 0) + { + Ice.EndpointParseException e = new Ice.EndpointParseException(); + e.str = str; + throw e; + } + + Regex p = new Regex("([ \t\n\r]+)|$"); + Match m = p.Match(s); + Debug.Assert(m.Success); + + string protocol = s.Substring(0, m.Index); + + if(protocol.Equals("default")) + { + protocol = _instance.defaultsAndOverrides().defaultProtocol; + } + + for(int i = 0; i < _factories.Count; i++) + { + EndpointFactory f = (EndpointFactory)_factories[i]; + if(f.protocol().Equals(protocol)) + { + return f.create(s.Substring(m.Index + m.Length)); + } + } + + Ice.EndpointParseException e2 = new Ice.EndpointParseException(); + e2.str = str; + throw e2; + } + } + + public Endpoint read(BasicStream s) + { + lock(this) + { + short type = s.readShort(); + + for(int i = 0; i < _factories.Count; i++) + { + EndpointFactory f = (EndpointFactory)_factories[i]; + if(f.type() == type) + { + return f.read(s); + } + } + + return new UnknownEndpoint(type, s); + } + } + + internal void destroy() + { + for(int i = 0; i < _factories.Count; i++) + { + EndpointFactory f = (EndpointFactory)_factories[i]; + f.destroy(); + } + _factories.Clear(); + } + + private readonly Instance _instance; + private readonly ArrayList _factories; + } + +} diff --git a/cs/src/Ice/Exception.cs b/cs/src/Ice/Exception.cs index 280e1193a89..bd7eb037985 100755 --- a/cs/src/Ice/Exception.cs +++ b/cs/src/Ice/Exception.cs @@ -1,54 +1,54 @@ -namespace Ice
-{
-
- public abstract class Exception : System.ApplicationException
- {
- public Exception() {}
- public Exception(string msg) : base(msg) {}
- public Exception(System.Exception ex) : base(_dflt, ex) {}
- public Exception(string msg, System.Exception ex) : base(msg, ex) {}
- private static readonly string _dflt = "Ice.Exception";
- }
-
- public abstract class LocalException : Exception
- {
- public LocalException() {}
- public LocalException(string msg) : base(msg) {}
- public LocalException(System.Exception ex) : base(_dflt, ex) {}
- public LocalException(string msg, System.Exception ex) : base(msg, ex) {}
- private static readonly string _dflt = "Ice.LocalException";
- }
-
- public abstract class UserException : Exception
- {
- public UserException() {}
- public UserException(string msg) : base(msg) {}
- public UserException(System.Exception ex) : base(_dflt, ex) {}
- public UserException(string msg, System.Exception ex) : base(msg, ex) {}
- private static readonly string _dflt = "Ice.UserException";
- public abstract void __write(IceInternal.BasicStream __os);
- public abstract void __read(IceInternal.BasicStream __is, bool __rid);
- public abstract bool __usesClasses();
- }
-
-}
-
-namespace IceInternal
-{
-
- public class NonRepeatable : Ice.Exception
- {
- public NonRepeatable(Ice.LocalException ex)
- {
- _ex = ex;
- }
-
- public virtual Ice.LocalException get()
- {
- return _ex;
- }
-
- private Ice.LocalException _ex;
- }
-
-}
+namespace Ice +{ + + public abstract class Exception : System.ApplicationException + { + public Exception() {} + public Exception(string msg) : base(msg) {} + public Exception(System.Exception ex) : base(_dflt, ex) {} + public Exception(string msg, System.Exception ex) : base(msg, ex) {} + private static readonly string _dflt = "Ice.Exception"; + } + + public abstract class LocalException : Exception + { + public LocalException() {} + public LocalException(string msg) : base(msg) {} + public LocalException(System.Exception ex) : base(_dflt, ex) {} + public LocalException(string msg, System.Exception ex) : base(msg, ex) {} + private static readonly string _dflt = "Ice.LocalException"; + } + + public abstract class UserException : Exception + { + public UserException() {} + public UserException(string msg) : base(msg) {} + public UserException(System.Exception ex) : base(_dflt, ex) {} + public UserException(string msg, System.Exception ex) : base(msg, ex) {} + private static readonly string _dflt = "Ice.UserException"; + public abstract void __write(IceInternal.BasicStream __os); + public abstract void __read(IceInternal.BasicStream __is, bool __rid); + public abstract bool __usesClasses(); + } + +} + +namespace IceInternal +{ + + public class NonRepeatable : Ice.Exception + { + public NonRepeatable(Ice.LocalException ex) + { + _ex = ex; + } + + public virtual Ice.LocalException get() + { + return _ex; + } + + private Ice.LocalException _ex; + } + +} diff --git a/cs/src/Ice/IncomingAsync.cs b/cs/src/Ice/IncomingAsync.cs index 1920bc7f4fd..a59a8bf2a9e 100755 --- a/cs/src/Ice/IncomingAsync.cs +++ b/cs/src/Ice/IncomingAsync.cs @@ -200,38 +200,38 @@ namespace IceInternal namespace Ice { - public interface AMD_Object_ice_invoke
- {
- void ice_response(bool ok, byte[] outParams);
- void ice_exception(System.Exception ex);
- }
-
- sealed class _AMD_Object_ice_invoke : IceInternal.IncomingAsync, AMD_Object_ice_invoke
- {
- public _AMD_Object_ice_invoke(IceInternal.Incoming inc)
- : base(inc)
- {
- }
-
- public void ice_response(bool ok, byte[] outParams)
- {
- try
- {
- __os().writeBlob(outParams);
- }
- catch(Ice.LocalException ex)
- {
- __exception(ex);
- return;
- }
-
- __response(ok);
- }
-
- public void ice_exception(System.Exception ex)
- {
- __exception(ex);
- }
+ public interface AMD_Object_ice_invoke + { + void ice_response(bool ok, byte[] outParams); + void ice_exception(System.Exception ex); + } + + sealed class _AMD_Object_ice_invoke : IceInternal.IncomingAsync, AMD_Object_ice_invoke + { + public _AMD_Object_ice_invoke(IceInternal.Incoming inc) + : base(inc) + { + } + + public void ice_response(bool ok, byte[] outParams) + { + try + { + __os().writeBlob(outParams); + } + catch(Ice.LocalException ex) + { + __exception(ex); + return; + } + + __response(ok); + } + + public void ice_exception(System.Exception ex) + { + __exception(ex); + } } } diff --git a/cs/src/Ice/LocalObject.cs b/cs/src/Ice/LocalObject.cs index c37f6070425..4fc3a77c44a 100755 --- a/cs/src/Ice/LocalObject.cs +++ b/cs/src/Ice/LocalObject.cs @@ -7,21 +7,21 @@ // // ********************************************************************** -namespace Ice
-{
-
- public interface LocalObject
- {
- int ice_hash();
- }
-
- public abstract class LocalObjectImpl : LocalObject
- {
- public virtual int
- ice_hash()
- {
- return GetHashCode();
- }
- }
-
-}
+namespace Ice +{ + + public interface LocalObject + { + int ice_hash(); + } + + public abstract class LocalObjectImpl : LocalObject + { + public virtual int + ice_hash() + { + return GetHashCode(); + } + } + +} diff --git a/cs/src/Ice/LocatorInfo.cs b/cs/src/Ice/LocatorInfo.cs index 236a14aeae2..10a58434e1e 100755 --- a/cs/src/Ice/LocatorInfo.cs +++ b/cs/src/Ice/LocatorInfo.cs @@ -331,77 +331,77 @@ namespace IceInternal private Hashtable _locatorTables; } - sealed class LocatorTable
- {
- internal LocatorTable()
- {
- _adapterEndpointsTable = new Hashtable();
- _objectTable = new Hashtable();
- }
-
- internal void clear()
- {
- lock(this)
- {
- _adapterEndpointsTable.Clear();
- _objectTable.Clear();
- }
- }
-
- internal IceInternal.Endpoint[] getAdapterEndpoints(string adapter)
- {
- lock(this)
- {
- return (IceInternal.Endpoint[])_adapterEndpointsTable[adapter];
- }
- }
-
- internal void addAdapterEndpoints(string adapter, IceInternal.Endpoint[] endpoints)
- {
- lock(this)
- {
- _adapterEndpointsTable[adapter] = endpoints;
- }
- }
-
- internal IceInternal.Endpoint[] removeAdapterEndpoints(string adapter)
- {
- lock(this)
- {
- IceInternal.Endpoint[] endpoints = (IceInternal.Endpoint[])_adapterEndpointsTable[adapter];
- _adapterEndpointsTable.Remove(adapter);
- return endpoints;
- }
- }
-
- internal Ice.ObjectPrx getProxy(Ice.Identity id)
- {
- lock(this)
- {
- return (Ice.ObjectPrx)_objectTable[id];
- }
- }
-
- internal void addProxy(Ice.Identity id, Ice.ObjectPrx proxy)
- {
- lock(this)
- {
- _objectTable[id] = proxy;
- }
- }
-
- internal Ice.ObjectPrx removeProxy(Ice.Identity id)
- {
- lock(this)
- {
- Ice.ObjectPrx obj = (Ice.ObjectPrx)_objectTable[id];
- _objectTable.Remove(id);
- return obj;
- }
- }
-
- private Hashtable _adapterEndpointsTable;
- private Hashtable _objectTable;
+ sealed class LocatorTable + { + internal LocatorTable() + { + _adapterEndpointsTable = new Hashtable(); + _objectTable = new Hashtable(); + } + + internal void clear() + { + lock(this) + { + _adapterEndpointsTable.Clear(); + _objectTable.Clear(); + } + } + + internal IceInternal.Endpoint[] getAdapterEndpoints(string adapter) + { + lock(this) + { + return (IceInternal.Endpoint[])_adapterEndpointsTable[adapter]; + } + } + + internal void addAdapterEndpoints(string adapter, IceInternal.Endpoint[] endpoints) + { + lock(this) + { + _adapterEndpointsTable[adapter] = endpoints; + } + } + + internal IceInternal.Endpoint[] removeAdapterEndpoints(string adapter) + { + lock(this) + { + IceInternal.Endpoint[] endpoints = (IceInternal.Endpoint[])_adapterEndpointsTable[adapter]; + _adapterEndpointsTable.Remove(adapter); + return endpoints; + } + } + + internal Ice.ObjectPrx getProxy(Ice.Identity id) + { + lock(this) + { + return (Ice.ObjectPrx)_objectTable[id]; + } + } + + internal void addProxy(Ice.Identity id, Ice.ObjectPrx proxy) + { + lock(this) + { + _objectTable[id] = proxy; + } + } + + internal Ice.ObjectPrx removeProxy(Ice.Identity id) + { + lock(this) + { + Ice.ObjectPrx obj = (Ice.ObjectPrx)_objectTable[id]; + _objectTable.Remove(id); + return obj; + } + } + + private Hashtable _adapterEndpointsTable; + private Hashtable _objectTable; } } diff --git a/cs/src/Ice/OutgoingAsync.cs b/cs/src/Ice/OutgoingAsync.cs index f8221b86909..c51a90e8916 100755 --- a/cs/src/Ice/OutgoingAsync.cs +++ b/cs/src/Ice/OutgoingAsync.cs @@ -233,9 +233,12 @@ namespace IceInternal public bool __timedOut() { - _timeoutMutex.WaitOne(); - long absoluteTimeoutMillis = _absoluteTimeoutMillis; - _timeoutMutex.ReleaseMutex(); + long absoluteTimeoutMillis; + + lock(_timeoutMutex) // MONO bug: Should be WaitOne(), but that's broken under Mono 1.0 for Linux. + { + absoluteTimeoutMillis = _absoluteTimeoutMillis; + } if(absoluteTimeoutMillis > 0) { @@ -342,16 +345,17 @@ namespace IceInternal _connection = _reference.getConnection(out _compress); } - _timeoutMutex.WaitOne(); - if(_connection.timeout() >= 0) - { - _absoluteTimeoutMillis = System.DateTime.Now.Ticks / 10 + _connection.timeout(); - } - else - { - _absoluteTimeoutMillis = 0; - } - _timeoutMutex.ReleaseMutex(); + lock(_timeoutMutex) // MONO bug: Should be WaitOne(), but that's broken under Mono 1.0 for Linux. + { + if(_connection.timeout() >= 0) + { + _absoluteTimeoutMillis = System.DateTime.Now.Ticks / 10 + _connection.timeout(); + } + else + { + _absoluteTimeoutMillis = 0; + } + } try { diff --git a/cs/src/Ice/Patcher.cs b/cs/src/Ice/Patcher.cs index acc6eb27a27..2860b523025 100755 --- a/cs/src/Ice/Patcher.cs +++ b/cs/src/Ice/Patcher.cs @@ -6,93 +6,93 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -
-using System.Collections;
-using System.Diagnostics;
-using System.Text;
-
-namespace IceInternal
-{
- public abstract class Patcher
- {
- public Patcher()
- {
- }
-
- public Patcher(System.Type type)
- {
- _type = type;
- }
-
- public abstract void patch(Ice.Object v);
-
- public string type()
- {
- Debug.Assert(_type != null);
- return _type.FullName;
- }
-
- protected System.Type _type;
- }
-
- public sealed class ParamPatcher : Patcher
- {
- public ParamPatcher(System.Type type) : base(type)
- {
- }
-
- public override void patch(Ice.Object v)
- {
- Debug.Assert(_type != null);
- if(!_type.IsInstanceOfType(v))
- {
- throw new System.InvalidCastException("expected element of type " + type()
- + " but received " + v.GetType().FullName);
- }
- value = v;
- }
-
- public Ice.Object value;
- }
-
- public sealed class SequencePatcher : Patcher
- {
- public SequencePatcher(ICollection seq, System.Type type, int index) : base(type)
- {
- _seq = seq;
- _index = index;
- }
-
- private static object dummyObject = new object();
-
- public override void patch(Ice.Object v)
- {
- try
- {
- if(_seq is IList)
- {
- if(_index >= _seq.Count)
- {
- for(int i = _seq.Count; i <= _index; i++)
- {
- ((IList)_seq).Add(dummyObject); // IList implementation does not permit adding null :-(
- }
- }
- ((IList)_seq)[_index] = v;
- }
- else
- {
- ((System.Array)_seq).SetValue(v, _index);
- }
- }
- catch(System.Exception)
- {
- throw new System.InvalidCastException("expected element of type " + type()
- + " but received " + v.GetType().FullName);
- }
- }
-
- private ICollection _seq;
- private int _index;
- }
-}
+ +using System.Collections; +using System.Diagnostics; +using System.Text; + +namespace IceInternal +{ + public abstract class Patcher + { + public Patcher() + { + } + + public Patcher(System.Type type) + { + _type = type; + } + + public abstract void patch(Ice.Object v); + + public string type() + { + Debug.Assert(_type != null); + return _type.FullName; + } + + protected System.Type _type; + } + + public sealed class ParamPatcher : Patcher + { + public ParamPatcher(System.Type type) : base(type) + { + } + + public override void patch(Ice.Object v) + { + Debug.Assert(_type != null); + if(!_type.IsInstanceOfType(v)) + { + throw new System.InvalidCastException("expected element of type " + type() + + " but received " + v.GetType().FullName); + } + value = v; + } + + public Ice.Object value; + } + + public sealed class SequencePatcher : Patcher + { + public SequencePatcher(ICollection seq, System.Type type, int index) : base(type) + { + _seq = seq; + _index = index; + } + + private static object dummyObject = new object(); + + public override void patch(Ice.Object v) + { + try + { + if(_seq is IList) + { + if(_index >= _seq.Count) + { + for(int i = _seq.Count; i <= _index; i++) + { + ((IList)_seq).Add(dummyObject); // IList implementation does not permit adding null :-( + } + } + ((IList)_seq)[_index] = v; + } + else + { + ((System.Array)_seq).SetValue(v, _index); + } + } + catch(System.Exception) + { + throw new System.InvalidCastException("expected element of type " + type() + + " but received " + v.GetType().FullName); + } + } + + private ICollection _seq; + private int _index; + } +} diff --git a/cs/src/Ice/PluginManagerI.cs b/cs/src/Ice/PluginManagerI.cs index f46f8683afd..f5a7fc36b44 100755 --- a/cs/src/Ice/PluginManagerI.cs +++ b/cs/src/Ice/PluginManagerI.cs @@ -7,197 +7,197 @@ // // ********************************************************************** -namespace Ice
-{
-
- using System.Collections;
- using System.Diagnostics;
-
- public interface PluginFactory
- {
- Plugin create(Communicator communicator, System.String name, string[] args);
- }
-
- public sealed class PluginManagerI : LocalObjectImpl, PluginManager
- {
- private static string _kindOfObject = "plug-in";
-
- public Plugin getPlugin(string name)
- {
- lock(this)
- {
- if(_communicator == null)
- {
- throw new CommunicatorDestroyedException();
- }
-
- Plugin p = (Plugin)_plugins[name];
- if(p != null)
- {
- return p;
- }
- NotRegisteredException ex = new NotRegisteredException();
- ex.id = name;
- ex.kindOfObject = _kindOfObject;
- throw ex;
- }
- }
-
- public void addPlugin(string name, Plugin plugin)
- {
- lock(this)
- {
- if(_communicator == null)
- {
- throw new CommunicatorDestroyedException();
- }
-
- if(_plugins.Contains(name))
- {
- AlreadyRegisteredException ex = new AlreadyRegisteredException();
- ex.id = name;
- ex.kindOfObject = _kindOfObject;
- throw ex;
- }
- _plugins[name] = plugin;
- }
- }
-
- public void destroy()
- {
- lock(this)
- {
- if(_communicator != null)
- {
- foreach(Plugin plugin in _plugins.Values)
- {
- plugin.destroy();
- }
-
- _communicator = null;
- }
- }
- }
-
- public PluginManagerI(Communicator communicator)
- {
- _communicator = communicator;
- _plugins = new Hashtable();
- }
-
- public void loadPlugins(ref string[] cmdArgs)
- {
- Debug.Assert(_communicator != null);
-
- //
- // Load and initialize the plug-ins defined in the property set
- // with the prefix "Ice.Plugin.". These properties should
- // have the following format:
- //
- // Ice.Plugin.name=entry_point [args]
- //
- string prefix = "Ice.Plugin.";
- Ice.Properties properties = _communicator.getProperties();
- PropertyDict plugins = properties.getPropertiesForPrefix(prefix);
- foreach(DictionaryEntry entry in plugins)
- {
- string name = ((string)entry.Key).Substring(prefix.Length);
- string val = (string)entry.Value;
-
- //
- // Separate the entry point from the arguments.
- //
- string className;
- string[] args;
- int pos = val.IndexOf(' ');
- if(pos == -1)
- {
- pos = val.IndexOf('\t');
- }
- if(pos == -1)
- {
- pos = val.IndexOf('\n');
- }
- if(pos == -1)
- {
- className = val;
- args = new string[0];
- }
- else
- {
- className = val.Substring(0, pos);
- char[] delims = { ' ', '\t', '\n' };
- args = val.Substring(pos).Trim().Split(delims, pos);
- }
-
- //
- // Convert command-line options into properties. First we
- // convert the options from the plug-in configuration, then
- // we convert the options from the application command-line.
- //
- args = properties.parseCommandLineOptions(name, args);
- cmdArgs = properties.parseCommandLineOptions(name, cmdArgs);
-
- loadPlugin(name, className, args);
- }
- }
-
- private void loadPlugin(string name, string className, string[] args)
- {
- Debug.Assert(_communicator != null);
-
- //
- // Instantiate the class.
- //
- PluginFactory factory = null;
- try
- {
- System.Type c = System.Type.GetType(className);
- System.Object obj = IceInternal.AssemblyUtil.createInstance(c);
- try
- {
- factory = (PluginFactory) obj;
- }
- catch(System.InvalidCastException ex)
- {
- PluginInitializationException e = new PluginInitializationException(ex);
- e.reason = "class " + className + " does not implement Ice.PluginFactory";
- throw e;
- }
- }
- catch(System.UnauthorizedAccessException ex)
- {
- PluginInitializationException e = new PluginInitializationException(ex);
- e.reason = "unable to access default constructor in class " + className;
- throw e;
- }
- catch(System.Exception ex)
- {
- PluginInitializationException e = new PluginInitializationException(ex);
- e.reason = "unable to instantiate class " + className;
- throw e;
- }
-
- //
- // Invoke the factory.
- //
- Plugin plugin = null;
- try
- {
- plugin = factory.create(_communicator, name, args);
- }
- catch(System.Exception ex)
- {
- PluginInitializationException e = new PluginInitializationException(ex);
- e.reason = "exception in factory " + className;
- throw e;
- }
-
- _plugins[name] = plugin;
- }
-
- private Communicator _communicator;
- private Hashtable _plugins;
- }
-
-}
+namespace Ice +{ + + using System.Collections; + using System.Diagnostics; + + public interface PluginFactory + { + Plugin create(Communicator communicator, System.String name, string[] args); + } + + public sealed class PluginManagerI : LocalObjectImpl, PluginManager + { + private static string _kindOfObject = "plug-in"; + + public Plugin getPlugin(string name) + { + lock(this) + { + if(_communicator == null) + { + throw new CommunicatorDestroyedException(); + } + + Plugin p = (Plugin)_plugins[name]; + if(p != null) + { + return p; + } + NotRegisteredException ex = new NotRegisteredException(); + ex.id = name; + ex.kindOfObject = _kindOfObject; + throw ex; + } + } + + public void addPlugin(string name, Plugin plugin) + { + lock(this) + { + if(_communicator == null) + { + throw new CommunicatorDestroyedException(); + } + + if(_plugins.Contains(name)) + { + AlreadyRegisteredException ex = new AlreadyRegisteredException(); + ex.id = name; + ex.kindOfObject = _kindOfObject; + throw ex; + } + _plugins[name] = plugin; + } + } + + public void destroy() + { + lock(this) + { + if(_communicator != null) + { + foreach(Plugin plugin in _plugins.Values) + { + plugin.destroy(); + } + + _communicator = null; + } + } + } + + public PluginManagerI(Communicator communicator) + { + _communicator = communicator; + _plugins = new Hashtable(); + } + + public void loadPlugins(ref string[] cmdArgs) + { + Debug.Assert(_communicator != null); + + // + // Load and initialize the plug-ins defined in the property set + // with the prefix "Ice.Plugin.". These properties should + // have the following format: + // + // Ice.Plugin.name=entry_point [args] + // + string prefix = "Ice.Plugin."; + Ice.Properties properties = _communicator.getProperties(); + PropertyDict plugins = properties.getPropertiesForPrefix(prefix); + foreach(DictionaryEntry entry in plugins) + { + string name = ((string)entry.Key).Substring(prefix.Length); + string val = (string)entry.Value; + + // + // Separate the entry point from the arguments. + // + string className; + string[] args; + int pos = val.IndexOf(' '); + if(pos == -1) + { + pos = val.IndexOf('\t'); + } + if(pos == -1) + { + pos = val.IndexOf('\n'); + } + if(pos == -1) + { + className = val; + args = new string[0]; + } + else + { + className = val.Substring(0, pos); + char[] delims = { ' ', '\t', '\n' }; + args = val.Substring(pos).Trim().Split(delims, pos); + } + + // + // Convert command-line options into properties. First we + // convert the options from the plug-in configuration, then + // we convert the options from the application command-line. + // + args = properties.parseCommandLineOptions(name, args); + cmdArgs = properties.parseCommandLineOptions(name, cmdArgs); + + loadPlugin(name, className, args); + } + } + + private void loadPlugin(string name, string className, string[] args) + { + Debug.Assert(_communicator != null); + + // + // Instantiate the class. + // + PluginFactory factory = null; + try + { + System.Type c = System.Type.GetType(className); + System.Object obj = IceInternal.AssemblyUtil.createInstance(c); + try + { + factory = (PluginFactory) obj; + } + catch(System.InvalidCastException ex) + { + PluginInitializationException e = new PluginInitializationException(ex); + e.reason = "class " + className + " does not implement Ice.PluginFactory"; + throw e; + } + } + catch(System.UnauthorizedAccessException ex) + { + PluginInitializationException e = new PluginInitializationException(ex); + e.reason = "unable to access default constructor in class " + className; + throw e; + } + catch(System.Exception ex) + { + PluginInitializationException e = new PluginInitializationException(ex); + e.reason = "unable to instantiate class " + className; + throw e; + } + + // + // Invoke the factory. + // + Plugin plugin = null; + try + { + plugin = factory.create(_communicator, name, args); + } + catch(System.Exception ex) + { + PluginInitializationException e = new PluginInitializationException(ex); + e.reason = "exception in factory " + className; + throw e; + } + + _plugins[name] = plugin; + } + + private Communicator _communicator; + private Hashtable _plugins; + } + +} diff --git a/cs/src/Ice/Protocol.cs b/cs/src/Ice/Protocol.cs index 783eaf0272a..209f21a0d28 100755 --- a/cs/src/Ice/Protocol.cs +++ b/cs/src/Ice/Protocol.cs @@ -7,48 +7,48 @@ // // ********************************************************************** -
-namespace IceInternal
-{
-
- sealed class Protocol
- {
- //
- // Size of the Ice protocol header
- //
- // Magic number (4 bytes)
- // Protocol version major (Byte)
- // Protocol version minor (Byte)
- // Encoding version major (Byte)
- // Encoding version minor (Byte)
- // Message type (Byte)
- // Compression status (Byte)
- // Message size (Int)
- //
- internal const int headerSize = 14;
-
- //
- // The magic number at the front of each message
- //
- internal static readonly byte[] magic
- = new byte[] { (byte)0x49, (byte)0x63, (byte)0x65, (byte)0x50 }; // 'I', 'c', 'e', 'P'
-
- //
- // The current Ice protocol and encoding version
- //
- internal const byte protocolMajor = 1;
- internal const byte protocolMinor = 0;
- internal const byte encodingMajor = 1;
- internal const byte encodingMinor = 0;
-
- //
- // The Ice protocol message types
- //
- internal const byte requestMsg = 0;
- internal const byte requestBatchMsg = 1;
- internal const byte replyMsg = 2;
- internal const byte validateConnectionMsg = 3;
- internal const byte closeConnectionMsg = 4;
- }
-
-}
+ +namespace IceInternal +{ + + sealed class Protocol + { + // + // Size of the Ice protocol header + // + // Magic number (4 bytes) + // Protocol version major (Byte) + // Protocol version minor (Byte) + // Encoding version major (Byte) + // Encoding version minor (Byte) + // Message type (Byte) + // Compression status (Byte) + // Message size (Int) + // + internal const int headerSize = 14; + + // + // The magic number at the front of each message + // + internal static readonly byte[] magic + = new byte[] { (byte)0x49, (byte)0x63, (byte)0x65, (byte)0x50 }; // 'I', 'c', 'e', 'P' + + // + // The current Ice protocol and encoding version + // + internal const byte protocolMajor = 1; + internal const byte protocolMinor = 0; + internal const byte encodingMajor = 1; + internal const byte encodingMinor = 0; + + // + // The Ice protocol message types + // + internal const byte requestMsg = 0; + internal const byte requestBatchMsg = 1; + internal const byte replyMsg = 2; + internal const byte validateConnectionMsg = 3; + internal const byte closeConnectionMsg = 4; + } + +} diff --git a/cs/src/Ice/RouterInfo.cs b/cs/src/Ice/RouterInfo.cs index 9aa8fba9ab7..1377318fea5 100755 --- a/cs/src/Ice/RouterInfo.cs +++ b/cs/src/Ice/RouterInfo.cs @@ -7,183 +7,183 @@ // // ********************************************************************** -
-namespace IceInternal
-{
-
- using System.Collections;
- using System.Diagnostics;
-
- public sealed class RouterInfo
- {
-
- internal RouterInfo(Ice.RouterPrx router)
- {
- _router = router;
- _routingTable = new Ice.RoutingTable();
-
- Debug.Assert(_router != null);
- }
-
- public void destroy()
- {
- lock(this)
- {
- _clientProxy = null;
- _serverProxy = null;
- _adapter = null;
- _routingTable.clear();
- }
- }
-
- public override bool Equals(System.Object obj)
- {
- RouterInfo rhs = obj as RouterInfo;
- return rhs == null ? false : _router.Equals(rhs._router);
- }
-
- public override int GetHashCode()
- {
- return _router.GetHashCode();
- }
-
- public Ice.RouterPrx getRouter()
- {
- //
- // No mutex lock necessary, _router is immutable.
- //
- return _router;
- }
-
- public Ice.ObjectPrx getClientProxy()
- {
- lock(this)
- {
- if(_clientProxy == null)
- // Lazy initialization.
- {
- _clientProxy = _router.getClientProxy();
- if(_clientProxy == null)
- {
- throw new Ice.NoEndpointException();
- }
- _clientProxy = _clientProxy.ice_router(null); // The client proxy cannot be routed.
- }
-
- return _clientProxy;
- }
- }
-
- public void setClientProxy(Ice.ObjectPrx clientProxy)
- {
- lock(this)
- {
- _clientProxy = clientProxy.ice_router(null); // The client proxy cannot be routed.
- }
- }
-
- public Ice.ObjectPrx getServerProxy()
- {
- if(_serverProxy == null) // Lazy initialization.
- {
- _serverProxy = _router.getServerProxy();
- if(_serverProxy == null)
- {
- throw new Ice.NoEndpointException();
- }
- _serverProxy = _serverProxy.ice_router(null); // The server proxy cannot be routed.
- }
-
- return _serverProxy;
- }
-
- public void setServerProxy(Ice.ObjectPrx serverProxy)
- {
- _serverProxy = serverProxy.ice_router(null); // The server proxy cannot be routed.
- }
-
- public void addProxy(Ice.ObjectPrx proxy)
- {
- //
- // No mutex lock necessary, _routingTable is immutable, and
- // RoutingTable is mutex protected.
- //
- if(_routingTable.add(proxy))
- // Only add the proxy to the router if it's not already in the routing table.
- {
- _router.addProxy(proxy);
- }
- }
-
- public void setAdapter(Ice.ObjectAdapter adapter)
- {
- lock(this)
- {
- _adapter = adapter;
- }
- }
-
- public Ice.ObjectAdapter getAdapter()
- {
- lock(this)
- {
- return _adapter;
- }
- }
-
- private readonly Ice.RouterPrx _router;
- private Ice.ObjectPrx _clientProxy;
- private Ice.ObjectPrx _serverProxy;
- private readonly Ice.RoutingTable _routingTable;
- private Ice.ObjectAdapter _adapter;
- }
-
- public sealed class RouterManager
- {
- internal RouterManager()
- {
- _table = new Hashtable();
- }
-
- internal void destroy()
- {
- lock(this)
- {
- foreach(RouterInfo i in _table.Values)
- {
- i.destroy();
- }
- _table.Clear();
- }
- }
-
- //
- // Returns router info for a given router. Automatically creates
- // the router info if it doesn't exist yet.
- //
- public RouterInfo get(Ice.RouterPrx rtr)
- {
- if(rtr == null)
- {
- return null;
- }
-
- Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(rtr.ice_router(null)); // The router cannot be routed.
-
- lock(this)
- {
- RouterInfo info = (RouterInfo)_table[router];
- if(info == null)
- {
- info = new RouterInfo(router);
- _table[router] = info;
- }
-
- return info;
- }
- }
-
- private Hashtable _table;
- }
-
-}
+ +namespace IceInternal +{ + + using System.Collections; + using System.Diagnostics; + + public sealed class RouterInfo + { + + internal RouterInfo(Ice.RouterPrx router) + { + _router = router; + _routingTable = new Ice.RoutingTable(); + + Debug.Assert(_router != null); + } + + public void destroy() + { + lock(this) + { + _clientProxy = null; + _serverProxy = null; + _adapter = null; + _routingTable.clear(); + } + } + + public override bool Equals(System.Object obj) + { + RouterInfo rhs = obj as RouterInfo; + return rhs == null ? false : _router.Equals(rhs._router); + } + + public override int GetHashCode() + { + return _router.GetHashCode(); + } + + public Ice.RouterPrx getRouter() + { + // + // No mutex lock necessary, _router is immutable. + // + return _router; + } + + public Ice.ObjectPrx getClientProxy() + { + lock(this) + { + if(_clientProxy == null) + // Lazy initialization. + { + _clientProxy = _router.getClientProxy(); + if(_clientProxy == null) + { + throw new Ice.NoEndpointException(); + } + _clientProxy = _clientProxy.ice_router(null); // The client proxy cannot be routed. + } + + return _clientProxy; + } + } + + public void setClientProxy(Ice.ObjectPrx clientProxy) + { + lock(this) + { + _clientProxy = clientProxy.ice_router(null); // The client proxy cannot be routed. + } + } + + public Ice.ObjectPrx getServerProxy() + { + if(_serverProxy == null) // Lazy initialization. + { + _serverProxy = _router.getServerProxy(); + if(_serverProxy == null) + { + throw new Ice.NoEndpointException(); + } + _serverProxy = _serverProxy.ice_router(null); // The server proxy cannot be routed. + } + + return _serverProxy; + } + + public void setServerProxy(Ice.ObjectPrx serverProxy) + { + _serverProxy = serverProxy.ice_router(null); // The server proxy cannot be routed. + } + + public void addProxy(Ice.ObjectPrx proxy) + { + // + // No mutex lock necessary, _routingTable is immutable, and + // RoutingTable is mutex protected. + // + if(_routingTable.add(proxy)) + // Only add the proxy to the router if it's not already in the routing table. + { + _router.addProxy(proxy); + } + } + + public void setAdapter(Ice.ObjectAdapter adapter) + { + lock(this) + { + _adapter = adapter; + } + } + + public Ice.ObjectAdapter getAdapter() + { + lock(this) + { + return _adapter; + } + } + + private readonly Ice.RouterPrx _router; + private Ice.ObjectPrx _clientProxy; + private Ice.ObjectPrx _serverProxy; + private readonly Ice.RoutingTable _routingTable; + private Ice.ObjectAdapter _adapter; + } + + public sealed class RouterManager + { + internal RouterManager() + { + _table = new Hashtable(); + } + + internal void destroy() + { + lock(this) + { + foreach(RouterInfo i in _table.Values) + { + i.destroy(); + } + _table.Clear(); + } + } + + // + // Returns router info for a given router. Automatically creates + // the router info if it doesn't exist yet. + // + public RouterInfo get(Ice.RouterPrx rtr) + { + if(rtr == null) + { + return null; + } + + Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(rtr.ice_router(null)); // The router cannot be routed. + + lock(this) + { + RouterInfo info = (RouterInfo)_table[router]; + if(info == null) + { + info = new RouterInfo(router); + _table[router] = info; + } + + return info; + } + } + + private Hashtable _table; + } + +} diff --git a/cs/src/Ice/RoutingTable.cs b/cs/src/Ice/RoutingTable.cs index c52b8920d78..159bbf267d4 100755 --- a/cs/src/Ice/RoutingTable.cs +++ b/cs/src/Ice/RoutingTable.cs @@ -7,72 +7,72 @@ // // ********************************************************************** -namespace Ice
-{
-
- using System.Collections;
-
- public sealed class RoutingTable
- {
- public RoutingTable()
- {
- _table = new Hashtable();
- }
-
- //
- // Clear the contents of the routing table.
- //
- public void clear()
- {
- lock(this)
- {
- _table.Clear();
- }
- }
-
- //
- // Returns false if the Proxy exists already.
- //
- public bool add(ObjectPrx prx)
- {
- if(prx == null)
- {
- return false;
- }
-
- ObjectPrx proxy = prx.ice_default(); // We insert the proxy in it's default form into the routing table.
-
- lock(this)
- {
- if(!_table.Contains(proxy.ice_getIdentity()))
- {
- _table[proxy.ice_getIdentity()] = proxy;
- return true;
- }
- else
- {
- return false;
- }
- }
- }
-
- //
- // Returns null if no Proxy exists for the given identity.
- //
- public ObjectPrx get(Identity ident)
- {
- if(ident.name.Length == 0)
- {
- return null;
- }
-
- lock(this)
- {
- return (ObjectPrx)_table[ident];
- }
- }
-
- private Hashtable _table;
- }
-
-}
+namespace Ice +{ + + using System.Collections; + + public sealed class RoutingTable + { + public RoutingTable() + { + _table = new Hashtable(); + } + + // + // Clear the contents of the routing table. + // + public void clear() + { + lock(this) + { + _table.Clear(); + } + } + + // + // Returns false if the Proxy exists already. + // + public bool add(ObjectPrx prx) + { + if(prx == null) + { + return false; + } + + ObjectPrx proxy = prx.ice_default(); // We insert the proxy in it's default form into the routing table. + + lock(this) + { + if(!_table.Contains(proxy.ice_getIdentity())) + { + _table[proxy.ice_getIdentity()] = proxy; + return true; + } + else + { + return false; + } + } + } + + // + // Returns null if no Proxy exists for the given identity. + // + public ObjectPrx get(Identity ident) + { + if(ident.name.Length == 0) + { + return null; + } + + lock(this) + { + return (ObjectPrx)_table[ident]; + } + } + + private Hashtable _table; + } + +} diff --git a/cs/src/Ice/SliceChecksums.cs b/cs/src/Ice/SliceChecksums.cs index ed1121dd67c..4f93c791dab 100755 --- a/cs/src/Ice/SliceChecksums.cs +++ b/cs/src/Ice/SliceChecksums.cs @@ -20,7 +20,6 @@ namespace Ice static SliceChecksums() { - IceInternal.AssemblyUtil.loadAssemblies(); // Lazy initialization. Type[] types = IceInternal.AssemblyUtil.findTypesWithPrefix("IceInternal.SliceChecksums"); foreach(Type t in types) { diff --git a/cs/src/Ice/TcpAcceptor.cs b/cs/src/Ice/TcpAcceptor.cs index c38d79172e5..7bfede635eb 100755 --- a/cs/src/Ice/TcpAcceptor.cs +++ b/cs/src/Ice/TcpAcceptor.cs @@ -7,129 +7,129 @@ // // ********************************************************************** -
-namespace IceInternal
-{
-
- using System;
- using System.Diagnostics;
- using System.Net;
- using System.Net.Sockets;
-
- class TcpAcceptor : Acceptor
- {
- public virtual Socket fd()
- {
- return _fd;
- }
-
- public virtual void close()
- {
- if(_traceLevels.network >= 1)
- {
- string s = "stopping to accept tcp connections at " + ToString();
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- Socket fd = _fd;
- if(fd != null)
- {
- _fd = null;
- try
- {
- fd.Close();
- }
- catch(System.Exception)
- {
- // Ignore.
- }
- }
- }
-
- public virtual void listen()
- {
- Network.doListen(_fd, _backlog);
-
- if(_traceLevels.network >= 1)
- {
- string s = "accepting tcp connections at " + ToString();
- _logger.trace(_traceLevels.networkCat, s);
- }
- }
-
- public virtual Transceiver accept(int timeout)
- {
- Socket fd = Network.doAccept(_fd, timeout);
- Network.setBlock(fd, false);
-
- if(_traceLevels.network >= 1)
- {
- string s = "accepted tcp connection\n" + Network.fdToString(fd);
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- return new TcpTransceiver(_instance, fd);
- }
-
- public override string ToString()
- {
- return Network.addrToString(_addr);
- }
-
- internal bool equivalent(string host, int port)
- {
- EndPoint addr = Network.getAddress(host, port);
- return addr.Equals(_addr);
- }
-
- internal virtual int effectivePort()
- {
- return _addr.Port;
- }
-
- internal
- TcpAcceptor(Instance instance, string host, int port)
- {
- _instance = instance;
- _traceLevels = instance.traceLevels();
- _logger = instance.logger();
- _backlog = 0;
-
- if(_backlog <= 0)
- {
- _backlog = 5;
- }
-
- try
- {
- _fd = Network.createSocket(false);
- Network.setBlock(_fd, false);
- _addr = Network.getAddress(host, port);
- if(_traceLevels.network >= 2)
- {
- string s = "attempting to bind to tcp socket " + ToString();
- _logger.trace(_traceLevels.networkCat, s);
- }
- _addr = Network.doBind(_fd, _addr);
- }
- catch(System.Exception ex)
- {
- _fd = null;
- throw ex;
- }
- }
-
- ~TcpAcceptor()
- {
- Debug.Assert(_fd == null);
- }
-
- private Instance _instance;
- private TraceLevels _traceLevels;
- private Ice.Logger _logger;
- private Socket _fd;
- private int _backlog;
- private IPEndPoint _addr;
- }
-
-}
+ +namespace IceInternal +{ + + using System; + using System.Diagnostics; + using System.Net; + using System.Net.Sockets; + + class TcpAcceptor : Acceptor + { + public virtual Socket fd() + { + return _fd; + } + + public virtual void close() + { + if(_traceLevels.network >= 1) + { + string s = "stopping to accept tcp connections at " + ToString(); + _logger.trace(_traceLevels.networkCat, s); + } + + Socket fd = _fd; + if(fd != null) + { + _fd = null; + try + { + fd.Close(); + } + catch(System.Exception) + { + // Ignore. + } + } + } + + public virtual void listen() + { + Network.doListen(_fd, _backlog); + + if(_traceLevels.network >= 1) + { + string s = "accepting tcp connections at " + ToString(); + _logger.trace(_traceLevels.networkCat, s); + } + } + + public virtual Transceiver accept(int timeout) + { + Socket fd = Network.doAccept(_fd, timeout); + Network.setBlock(fd, false); + + if(_traceLevels.network >= 1) + { + string s = "accepted tcp connection\n" + Network.fdToString(fd); + _logger.trace(_traceLevels.networkCat, s); + } + + return new TcpTransceiver(_instance, fd); + } + + public override string ToString() + { + return Network.addrToString(_addr); + } + + internal bool equivalent(string host, int port) + { + EndPoint addr = Network.getAddress(host, port); + return addr.Equals(_addr); + } + + internal virtual int effectivePort() + { + return _addr.Port; + } + + internal + TcpAcceptor(Instance instance, string host, int port) + { + _instance = instance; + _traceLevels = instance.traceLevels(); + _logger = instance.logger(); + _backlog = 0; + + if(_backlog <= 0) + { + _backlog = 5; + } + + try + { + _fd = Network.createSocket(false); + Network.setBlock(_fd, false); + _addr = Network.getAddress(host, port); + if(_traceLevels.network >= 2) + { + string s = "attempting to bind to tcp socket " + ToString(); + _logger.trace(_traceLevels.networkCat, s); + } + _addr = Network.doBind(_fd, _addr); + } + catch(System.Exception ex) + { + _fd = null; + throw ex; + } + } + + ~TcpAcceptor() + { + Debug.Assert(_fd == null); + } + + private Instance _instance; + private TraceLevels _traceLevels; + private Ice.Logger _logger; + private Socket _fd; + private int _backlog; + private IPEndPoint _addr; + } + +} diff --git a/cs/src/Ice/TcpConnector.cs b/cs/src/Ice/TcpConnector.cs index a01348d6d31..cd345d53b1a 100755 --- a/cs/src/Ice/TcpConnector.cs +++ b/cs/src/Ice/TcpConnector.cs @@ -7,57 +7,57 @@ // // ********************************************************************** -
-namespace IceInternal
-{
-
- using System.Net;
- using System.Net.Sockets;
-
- sealed class TcpConnector : Connector
- {
- public Transceiver connect(int timeout)
- {
- if(_traceLevels.network >= 2)
- {
- string s = "trying to establish tcp connection to " + ToString();
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- Socket fd = Network.createSocket(false);
- Network.setBlock(fd, false);
- Network.doConnect(fd, _addr, timeout);
-
- if(_traceLevels.network >= 1)
- {
- string s = "tcp connection established\n" + Network.fdToString(fd);
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- return new TcpTransceiver(_instance, fd);
- }
-
- public override string ToString()
- {
- return Network.addrToString(_addr);
- }
-
- //
- // Only for use by TcpEndpoint
- //
- internal TcpConnector(Instance instance, string host, int port)
- {
- _instance = instance;
- _traceLevels = instance.traceLevels();
- _logger = instance.logger();
-
- _addr = Network.getAddress(host, port);
- }
-
- private Instance _instance;
- private TraceLevels _traceLevels;
- private Ice.Logger _logger;
- private IPEndPoint _addr;
- }
-
-}
+ +namespace IceInternal +{ + + using System.Net; + using System.Net.Sockets; + + sealed class TcpConnector : Connector + { + public Transceiver connect(int timeout) + { + if(_traceLevels.network >= 2) + { + string s = "trying to establish tcp connection to " + ToString(); + _logger.trace(_traceLevels.networkCat, s); + } + + Socket fd = Network.createSocket(false); + Network.setBlock(fd, false); + Network.doConnect(fd, _addr, timeout); + + if(_traceLevels.network >= 1) + { + string s = "tcp connection established\n" + Network.fdToString(fd); + _logger.trace(_traceLevels.networkCat, s); + } + + return new TcpTransceiver(_instance, fd); + } + + public override string ToString() + { + return Network.addrToString(_addr); + } + + // + // Only for use by TcpEndpoint + // + internal TcpConnector(Instance instance, string host, int port) + { + _instance = instance; + _traceLevels = instance.traceLevels(); + _logger = instance.logger(); + + _addr = Network.getAddress(host, port); + } + + private Instance _instance; + private TraceLevels _traceLevels; + private Ice.Logger _logger; + private IPEndPoint _addr; + } + +} diff --git a/cs/src/Ice/TcpTransceiver.cs b/cs/src/Ice/TcpTransceiver.cs index 577bcbc7838..1631cc5c12d 100755 --- a/cs/src/Ice/TcpTransceiver.cs +++ b/cs/src/Ice/TcpTransceiver.cs @@ -7,260 +7,260 @@ // // ********************************************************************** -
-namespace IceInternal
-{
-
- using System.Collections;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Net.Sockets;
-
- sealed class TcpTransceiver : Transceiver
- {
- public Socket fd()
- {
- Debug.Assert(_fd != null);
- return _fd;
- }
-
- public void close()
- {
- if(_traceLevels.network >= 1)
- {
- string s = "closing tcp connection\n" + ToString();
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- Debug.Assert(_fd != null);
- try
- {
- _fd.Close();
- _fd = null;
- }
- catch(System.IO.IOException ex)
- {
- throw new Ice.SocketException(ex);
- }
- }
-
- public void shutdown()
- {
- if(_traceLevels.network >= 2)
- {
- string s = "shutting down tcp connection\n" + ToString();
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- Debug.Assert(_fd != null);
- try
- {
- _fd.Shutdown(SocketShutdown.Send); // Shutdown socket for writing
- }
- catch(System.IO.IOException ex)
- {
- throw new Ice.SocketException(ex);
- }
- }
-
- public void write(BasicStream stream, int timeout)
- {
- Debug.Assert(_fd != null);
-
- ByteBuffer buf = stream.prepareWrite();
- int remaining = buf.remaining();
- int position = buf.position();
- try
- {
- while(remaining > 0)
- {
- int ret;
- try
- {
- //
- // Try to send first. Most of the time, this will work and
- // avoids the cost of calling Poll().
- //
- ret = _fd.Send(buf.rawBytes(), position, remaining, SocketFlags.None);
- Debug.Assert(ret != 0);
- }
- catch(Win32Exception e)
- {
- if(Network.wouldBlock(e))
- {
- if(timeout == 0)
- {
- throw new Ice.TimeoutException();
- }
- ret = 0;
- }
- else
- {
- throw;
- }
- }
- if(ret == 0)
- {
- //
- // The first attempt to write would have blocked,
- // so wait for the socket to become writable now.
- //
- if(!Network.doPoll(_fd, timeout, Network.PollMode.Write))
- {
- throw new Ice.TimeoutException();
- }
- ret = _fd.Send(buf.rawBytes(), position, remaining, SocketFlags.None);
- Debug.Assert(ret != 0);
- }
-
- if(_traceLevels.network >= 3)
- {
- string s = "sent " + ret + " of " + remaining + " bytes via tcp\n" + ToString();
- _logger.trace(_traceLevels.networkCat, s);
- }
- if(_stats != null)
- {
- _stats.bytesSent("tcp", ret);
- }
-
- remaining -= ret;
- buf.position(position += ret);
- }
- }
- catch(SocketException ex)
- {
- if(Network.connectionLost(ex))
- {
- throw new Ice.ConnectionLostException(ex);
- }
- if(Network.wouldBlock(ex))
- {
- throw new Ice.TimeoutException();
- }
- throw new Ice.SocketException(ex);
- }
- catch(Ice.LocalException)
- {
- throw;
- }
- catch(System.Exception ex)
- {
- throw new Ice.SyscallException(ex);
- }
- }
-
- public void read(BasicStream stream, int timeout)
- {
- Debug.Assert(_fd != null);
-
- ByteBuffer buf = stream.prepareRead();
- int remaining = buf.remaining();
- int position = buf.position();
-
- try
- {
- while(remaining > 0)
- {
- int ret;
- try
- {
- //
- // Try to receive first. Much of the time, this will work and we
- // avoid the cost of calling Poll().
- //
- ret = _fd.Receive(buf.rawBytes(), position, remaining, SocketFlags.None);
- }
- catch(Win32Exception e)
- {
- if(Network.wouldBlock(e))
- {
- if(timeout == 0)
- {
- throw new Ice.TimeoutException();
- }
- ret = 0;
- }
- else
- {
- throw;
- }
- }
- if(ret == 0)
- {
- if(!Network.doPoll(_fd, timeout, Network.PollMode.Read))
- {
- throw new Ice.TimeoutException();
- }
- ret = _fd.Receive(buf.rawBytes(), position, remaining, SocketFlags.None);
- if(ret == 0)
- {
- throw new Ice.ConnectionLostException();
- }
- }
- if(_traceLevels.network >= 3)
- {
- string s = "received " + ret + " of " + remaining + " bytes via tcp\n" + ToString();
- _logger.trace(_traceLevels.networkCat, s);
- }
- if(_stats != null)
- {
- _stats.bytesReceived("tcp", ret);
- }
- remaining -= ret;
- buf.position(position += ret);
- }
- }
- catch(SocketException ex)
- {
- if(Network.connectionLost(ex))
- {
- throw new Ice.ConnectionLostException(ex);
- }
- if(Network.wouldBlock(ex))
- {
- throw new Ice.TimeoutException();
- }
- throw new Ice.SocketException(ex);
- }
- catch(Ice.LocalException)
- {
- throw;
- }
- catch(System.Exception ex)
- {
- throw new Ice.SyscallException(ex);
- }
- }
-
- public override string ToString()
- {
- return _desc;
- }
-
- //
- // Only for use by TcpConnector, TcpAcceptor
- //
- internal TcpTransceiver(Instance instance, Socket fd)
- {
- _fd = fd;
- _traceLevels = instance.traceLevels();
- _logger = instance.logger();
- _stats = instance.stats();
- _desc = Network.fdToString(_fd);
- _bytes = new byte[Protocol.headerSize];
- }
-
- ~TcpTransceiver()
- {
- Debug.Assert(_fd == null);
- }
-
- private Socket _fd;
- private TraceLevels _traceLevels;
- private Ice.Logger _logger;
- private Ice.Stats _stats;
- private string _desc;
- private byte[] _bytes;
- }
-
-}
+ +namespace IceInternal +{ + + using System.Collections; + using System.ComponentModel; + using System.Diagnostics; + using System.Net.Sockets; + + sealed class TcpTransceiver : Transceiver + { + public Socket fd() + { + Debug.Assert(_fd != null); + return _fd; + } + + public void close() + { + if(_traceLevels.network >= 1) + { + string s = "closing tcp connection\n" + ToString(); + _logger.trace(_traceLevels.networkCat, s); + } + + Debug.Assert(_fd != null); + try + { + _fd.Close(); + _fd = null; + } + catch(System.IO.IOException ex) + { + throw new Ice.SocketException(ex); + } + } + + public void shutdown() + { + if(_traceLevels.network >= 2) + { + string s = "shutting down tcp connection\n" + ToString(); + _logger.trace(_traceLevels.networkCat, s); + } + + Debug.Assert(_fd != null); + try + { + _fd.Shutdown(SocketShutdown.Send); // Shutdown socket for writing + } + catch(System.IO.IOException ex) + { + throw new Ice.SocketException(ex); + } + } + + public void write(BasicStream stream, int timeout) + { + Debug.Assert(_fd != null); + + ByteBuffer buf = stream.prepareWrite(); + int remaining = buf.remaining(); + int position = buf.position(); + try + { + while(remaining > 0) + { + int ret; + try + { + // + // Try to send first. Most of the time, this will work and + // avoids the cost of calling Poll(). + // + ret = _fd.Send(buf.rawBytes(), position, remaining, SocketFlags.None); + Debug.Assert(ret != 0); + } + catch(Win32Exception e) + { + if(Network.wouldBlock(e)) + { + if(timeout == 0) + { + throw new Ice.TimeoutException(); + } + ret = 0; + } + else + { + throw; + } + } + if(ret == 0) + { + // + // The first attempt to write would have blocked, + // so wait for the socket to become writable now. + // + if(!Network.doPoll(_fd, timeout, Network.PollMode.Write)) + { + throw new Ice.TimeoutException(); + } + ret = _fd.Send(buf.rawBytes(), position, remaining, SocketFlags.None); + Debug.Assert(ret != 0); + } + + if(_traceLevels.network >= 3) + { + string s = "sent " + ret + " of " + remaining + " bytes via tcp\n" + ToString(); + _logger.trace(_traceLevels.networkCat, s); + } + if(_stats != null) + { + _stats.bytesSent("tcp", ret); + } + + remaining -= ret; + buf.position(position += ret); + } + } + catch(SocketException ex) + { + if(Network.connectionLost(ex)) + { + throw new Ice.ConnectionLostException(ex); + } + if(Network.wouldBlock(ex)) + { + throw new Ice.TimeoutException(); + } + throw new Ice.SocketException(ex); + } + catch(Ice.LocalException) + { + throw; + } + catch(System.Exception ex) + { + throw new Ice.SyscallException(ex); + } + } + + public void read(BasicStream stream, int timeout) + { + Debug.Assert(_fd != null); + + ByteBuffer buf = stream.prepareRead(); + int remaining = buf.remaining(); + int position = buf.position(); + + try + { + while(remaining > 0) + { + int ret; + try + { + // + // Try to receive first. Much of the time, this will work and we + // avoid the cost of calling Poll(). + // + ret = _fd.Receive(buf.rawBytes(), position, remaining, SocketFlags.None); + } + catch(Win32Exception e) + { + if(Network.wouldBlock(e)) + { + if(timeout == 0) + { + throw new Ice.TimeoutException(); + } + ret = 0; + } + else + { + throw; + } + } + if(ret == 0) + { + if(!Network.doPoll(_fd, timeout, Network.PollMode.Read)) + { + throw new Ice.TimeoutException(); + } + ret = _fd.Receive(buf.rawBytes(), position, remaining, SocketFlags.None); + if(ret == 0) + { + throw new Ice.ConnectionLostException(); + } + } + if(_traceLevels.network >= 3) + { + string s = "received " + ret + " of " + remaining + " bytes via tcp\n" + ToString(); + _logger.trace(_traceLevels.networkCat, s); + } + if(_stats != null) + { + _stats.bytesReceived("tcp", ret); + } + remaining -= ret; + buf.position(position += ret); + } + } + catch(SocketException ex) + { + if(Network.connectionLost(ex)) + { + throw new Ice.ConnectionLostException(ex); + } + if(Network.wouldBlock(ex)) + { + throw new Ice.TimeoutException(); + } + throw new Ice.SocketException(ex); + } + catch(Ice.LocalException) + { + throw; + } + catch(System.Exception ex) + { + throw new Ice.SyscallException(ex); + } + } + + public override string ToString() + { + return _desc; + } + + // + // Only for use by TcpConnector, TcpAcceptor + // + internal TcpTransceiver(Instance instance, Socket fd) + { + _fd = fd; + _traceLevels = instance.traceLevels(); + _logger = instance.logger(); + _stats = instance.stats(); + _desc = Network.fdToString(_fd); + _bytes = new byte[Protocol.headerSize]; + } + + ~TcpTransceiver() + { + Debug.Assert(_fd == null); + } + + private Socket _fd; + private TraceLevels _traceLevels; + private Ice.Logger _logger; + private Ice.Stats _stats; + private string _desc; + private byte[] _bytes; + } + +} diff --git a/cs/src/Ice/TraceLevels.cs b/cs/src/Ice/TraceLevels.cs index bc0f737e1ab..670127f103d 100755 --- a/cs/src/Ice/TraceLevels.cs +++ b/cs/src/Ice/TraceLevels.cs @@ -7,43 +7,43 @@ // // ********************************************************************** -
-namespace IceInternal
-{
-
- public sealed class TraceLevels
- {
- internal TraceLevels(Ice.Properties properties)
- {
- networkCat = "Network";
- protocolCat = "Protocol";
- retryCat = "Retry";
- securityCat = "Security";
- locationCat = "Location";
- slicingCat = "Slicing";
-
- string keyBase = "Ice.Trace.";
-
- network = properties.getPropertyAsInt(keyBase + networkCat);
- protocol = properties.getPropertyAsInt(keyBase + protocolCat);
- retry = properties.getPropertyAsInt(keyBase + retryCat);
- security = properties.getPropertyAsInt(keyBase + securityCat);
- location = properties.getPropertyAsInt(keyBase + locationCat);
- slicing = properties.getPropertyAsInt(keyBase + slicingCat);
- }
-
- public readonly int network;
- public readonly string networkCat;
- public readonly int protocol;
- public readonly string protocolCat;
- public readonly int retry;
- public readonly string retryCat;
- public readonly int security;
- public readonly string securityCat;
- public readonly int location;
- public readonly string locationCat;
- public readonly int slicing;
- public readonly string slicingCat;
- }
-
-}
+ +namespace IceInternal +{ + + public sealed class TraceLevels + { + internal TraceLevels(Ice.Properties properties) + { + networkCat = "Network"; + protocolCat = "Protocol"; + retryCat = "Retry"; + securityCat = "Security"; + locationCat = "Location"; + slicingCat = "Slicing"; + + string keyBase = "Ice.Trace."; + + network = properties.getPropertyAsInt(keyBase + networkCat); + protocol = properties.getPropertyAsInt(keyBase + protocolCat); + retry = properties.getPropertyAsInt(keyBase + retryCat); + security = properties.getPropertyAsInt(keyBase + securityCat); + location = properties.getPropertyAsInt(keyBase + locationCat); + slicing = properties.getPropertyAsInt(keyBase + slicingCat); + } + + public readonly int network; + public readonly string networkCat; + public readonly int protocol; + public readonly string protocolCat; + public readonly int retry; + public readonly string retryCat; + public readonly int security; + public readonly string securityCat; + public readonly int location; + public readonly string locationCat; + public readonly int slicing; + public readonly string slicingCat; + } + +} diff --git a/cs/src/Ice/UdpEndpoint.cs b/cs/src/Ice/UdpEndpoint.cs index f857b42fd51..86efc532fbf 100755 --- a/cs/src/Ice/UdpEndpoint.cs +++ b/cs/src/Ice/UdpEndpoint.cs @@ -651,39 +651,39 @@ namespace IceInternal private int _hashCode; } - sealed class UdpEndpointFactory : EndpointFactory
- {
- internal UdpEndpointFactory(Instance instance)
- {
- _instance = instance;
- }
-
- public short type()
- {
- return UdpEndpoint.TYPE;
- }
-
- public string protocol()
- {
- return "udp";
- }
-
- public Endpoint create(string str)
- {
- return new UdpEndpoint(_instance, str);
- }
-
- public Endpoint read(BasicStream s)
- {
- return new UdpEndpoint(s);
- }
-
- public void destroy()
- {
- _instance = null;
- }
-
- private Instance _instance;
+ sealed class UdpEndpointFactory : EndpointFactory + { + internal UdpEndpointFactory(Instance instance) + { + _instance = instance; + } + + public short type() + { + return UdpEndpoint.TYPE; + } + + public string protocol() + { + return "udp"; + } + + public Endpoint create(string str) + { + return new UdpEndpoint(_instance, str); + } + + public Endpoint read(BasicStream s) + { + return new UdpEndpoint(s); + } + + public void destroy() + { + _instance = null; + } + + private Instance _instance; } } diff --git a/cs/src/Ice/UdpTransceiver.cs b/cs/src/Ice/UdpTransceiver.cs index 84b1662ac26..8d4ee2d4cfe 100755 --- a/cs/src/Ice/UdpTransceiver.cs +++ b/cs/src/Ice/UdpTransceiver.cs @@ -7,412 +7,412 @@ // // ********************************************************************** -
-namespace IceInternal
-{
-
- using System.Collections;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Net;
- using System.Net.Sockets;
-
- sealed class UdpTransceiver : Transceiver
- {
- public Socket fd()
- {
- Debug.Assert(_fd != null);
- return _fd;
- }
-
- public void close()
- {
- if(_traceLevels.network >= 1)
- {
- string s = "closing udp connection\n" + ToString();
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- Debug.Assert(_fd != null);
- try
- {
- _fd.Close();
- }
- catch(System.IO.IOException)
- {
- }
- _fd = null;
- }
-
- public void shutdown()
- {
- }
-
- public void write(BasicStream stream, int timeout)
- {
- Debug.Assert(_fd != null);
-
- ByteBuffer buf = stream.prepareWrite();
-
- Debug.Assert(buf.position() == 0);
- int packetSize = System.Math.Min(_maxPacketSize, _sndSize - _udpOverhead);
- if(packetSize < buf.limit())
- {
- //
- // We don't log a warning here because the client gets an exception anyway.
- //
- throw new Ice.DatagramLimitException();
- }
-
- try
- {
- int remaining = buf.remaining();
- int ret;
- try
- {
- ret = _fd.Send(buf.rawBytes(), 0, remaining, SocketFlags.None);
- }
- catch(Win32Exception e)
- {
- if(Network.wouldBlock(e))
- {
- if(timeout == 0)
- {
- throw new Ice.TimeoutException();
- }
- ret = 0;
- }
- else
- {
- throw;
- }
- }
- if(ret == 0)
- {
- if(!Network.doPoll(_fd, timeout, Network.PollMode.Write))
- {
- throw new Ice.TimeoutException();
- }
- ret = _fd.Send(buf.rawBytes(), 0, remaining, SocketFlags.None);
- }
- if(ret != remaining)
- {
- throw new Ice.DatagramLimitException();
- }
-
- if(_traceLevels.network >= 3)
- {
- string s = "sent " + ret + " bytes via udp\n" + ToString();
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- if(_stats != null)
- {
- _stats.bytesSent("udp", ret);
- }
-
- buf.position(remaining);
- }
- catch(SocketException ex)
- {
- throw new Ice.SocketException(ex);
- }
- catch(Ice.LocalException)
- {
- throw;
- }
- catch(System.Exception ex)
- {
- throw new Ice.SyscallException(ex);
- }
- }
-
- public void read(BasicStream stream, int timeout)
- {
- Debug.Assert(stream.pos() == 0);
- int packetSize = System.Math.Min(_maxPacketSize, _rcvSize - _udpOverhead);
- if(packetSize < stream.size())
- {
- //
- // We log a warning here because this is the server side -- without the
- // the warning, there would only be silence.
- //
- if(_warn)
- {
- _logger.warning("DatagramLimitException: maximum size of " + packetSize + " exceeded");
- }
- throw new Ice.DatagramLimitException();
- }
- stream.resize(packetSize, true);
- ByteBuffer buf = stream.prepareRead();
- buf.position(0);
-
- try
- {
- int ret;
- try
- {
- Debug.Assert(_fd != null);
- ret = _fd.Receive(buf.rawBytes(), 0, buf.limit(), SocketFlags.None);
- }
- catch(Win32Exception e)
- {
- if(Network.wouldBlock(e))
- {
- if(timeout == 0)
- {
- throw new Ice.TimeoutException();
- }
- ret = 0;
- }
- else
- {
- throw;
- }
- }
- if(ret == 0)
- {
- if(!Network.doPoll(_fd, timeout, Network.PollMode.Read))
- {
- throw new Ice.TimeoutException();
- }
- ret = _fd.Receive(buf.rawBytes(), 0, buf.limit(), SocketFlags.None);
- Debug.Assert(ret != 0);
- }
- if(_connect)
- {
- //
- // If we must connect, then we connect to the first peer that
- // sends us a packet.
- //
- if(ret != 0)
- {
- Network.doConnect(_fd, _fd.RemoteEndPoint, -1);
- _connect = false; // We're connected now
-
- if(_traceLevels.network >= 1)
- {
- string s = "connected udp socket\n" + ToString();
- _logger.trace(_traceLevels.networkCat, s);
- }
- }
- }
- if(_traceLevels.network >= 3)
- {
- string s = "received " + ret + " bytes via udp\n" + ToString();
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- if(_stats != null)
- {
- _stats.bytesReceived("udp", ret);
- }
-
- stream.resize(ret, true);
- }
- catch(SocketException ex)
- {
- throw new Ice.SocketException(ex);
- }
- catch(Ice.LocalException)
- {
- throw;
- }
- catch(System.Exception ex)
- {
- throw new Ice.SyscallException(ex);
- }
- }
-
- public override string ToString()
- {
- return Network.fdToString(_fd);
- }
-
- public bool equivalent(string host, int port)
- {
- IPEndPoint addr = ((IPEndPoint)Network.getAddress(host, port));
- return addr.Equals(_addr);
- }
-
- public int effectivePort()
- {
- return _addr.Port;
- }
-
- //
- // Only for use by UdpEndpoint
- //
- internal UdpTransceiver(Instance instance, string host, int port)
- {
- _traceLevels = instance.traceLevels();
- _logger = instance.logger();
- _stats = instance.stats();
- _connect = true;
- _warn = instance.properties().getPropertyAsInt("Ice.Warn.Datagrams") > 0;
-
- try
- {
- _fd = Network.createSocket(true);
- setBufSize(instance);
- Network.setBlock(_fd, false);
- _addr = Network.getAddress(host, port);
- Network.doConnect(_fd, _addr, -1);
- _connect = false; // We're connected now
-
- if(_traceLevels.network >= 1)
- {
- string s = "starting to send udp packets\n" + ToString();
- _logger.trace(_traceLevels.networkCat, s);
- }
- }
- catch(Ice.LocalException ex)
- {
- _fd = null;
- throw ex;
- }
- }
-
- //
- // Only for use by UdpEndpoint
- //
- internal UdpTransceiver(Instance instance, string host, int port, bool connect)
- {
- _traceLevels = instance.traceLevels();
- _logger = instance.logger();
- _stats = instance.stats();
- _connect = connect;
- _warn = instance.properties().getPropertyAsInt("Ice.Warn.Datagrams") > 0;
-
- try
- {
- _fd = Network.createSocket(true);
- setBufSize(instance);
- Network.setBlock(_fd, false);
- _addr = Network.getAddress(host, port);
- if(_traceLevels.network >= 2)
- {
- string s = "attempting to bind to udp socket " + Network.addrToString(_addr);
- _logger.trace(_traceLevels.networkCat, s);
- }
- _addr = Network.doBind(_fd, _addr);
-
- if(_traceLevels.network >= 1)
- {
- string s = "starting to receive udp packets\n" + ToString();
- _logger.trace(_traceLevels.networkCat, s);
- }
- }
- catch(Ice.LocalException ex)
- {
- _fd = null;
- throw ex;
- }
- }
-
- private void setBufSize(Instance instance)
- {
- lock(this)
- {
- Debug.Assert(_fd != null);
-
- for (int i = 0; i < 2; ++i)
- {
- string direction;
- string prop;
- int dfltSize;
- if(i == 0)
- {
- direction = "receive";
- prop = "Ice.UDP.RcvSize";
- dfltSize = Network.getRecvBufferSize(_fd);
- _rcvSize = dfltSize;
- }
- else
- {
- direction = "send";
- prop = "Ice.UDP.SndSize";
- dfltSize = Network.getSendBufferSize(_fd);
- _sndSize = dfltSize;
- }
-
- //
- // Get property for buffer size and check for sanity.
- //
- int sizeRequested = instance.properties().getPropertyAsIntWithDefault(prop, dfltSize);
- if(sizeRequested < _udpOverhead)
- {
- _logger.warning("Invalid " + prop + " value of " + sizeRequested + " adjusted to " + dfltSize);
- sizeRequested = dfltSize;
- }
-
- //
- // Ice.MessageSizeMax overrides UDP buffer sizes if Ice.MessageSizeMax + _udpOverhead is less.
- //
- int messageSizeMax = instance.messageSizeMax();
- if(sizeRequested > messageSizeMax + _udpOverhead)
- {
- int newSize = System.Math.Min(messageSizeMax, _maxPacketSize) + _udpOverhead;
- _logger.warning("UDP " + direction + " buffer size: request size of " + sizeRequested + " adjusted to "
- + newSize + " (Ice.MessageSizeMax takes precendence)");
- sizeRequested = newSize;
- }
-
- if(sizeRequested != dfltSize)
- {
- //
- // Try to set the buffer size. The kernel will silently adjust
- // the size to an acceptable value. Then read the size back to
- // get the size that was actually set.
- //
- int sizeSet;
- if(i == 0)
- {
- Network.setRecvBufferSize(_fd, sizeRequested);
- _rcvSize = Network.getRecvBufferSize(_fd);
- sizeSet = _rcvSize;
- }
- else
- {
- Network.setSendBufferSize(_fd, sizeRequested);
- _sndSize = Network.getSendBufferSize(_fd);
- sizeSet = _sndSize;
- }
-
- //
- // Warn if the size that was set is less than the requested size.
- //
- if(sizeSet < sizeRequested)
- {
- _logger.warning("UDP " + direction + " buffer size: requested size of " + sizeRequested + " adjusted to " + sizeSet);
- }
- }
- }
- }
- }
-
-
- ~UdpTransceiver()
- {
- Debug.Assert(_fd == null);
- }
-
- private TraceLevels _traceLevels;
- private Ice.Logger _logger;
- private Ice.Stats _stats;
- private bool _connect;
- private readonly bool _warn;
- private int _rcvSize;
- private int _sndSize;
- private Socket _fd;
- private IPEndPoint _addr;
-
- //
- // The maximum IP datagram size is 65535. Subtract 20 bytes for the IP header and 8 bytes for the UDP header
- // to get the maximum payload.
- //
- private const int _udpOverhead = 20 + 8;
- private static readonly int _maxPacketSize = 65535 - _udpOverhead;
- }
-
-}
+ +namespace IceInternal +{ + + using System.Collections; + using System.ComponentModel; + using System.Diagnostics; + using System.Net; + using System.Net.Sockets; + + sealed class UdpTransceiver : Transceiver + { + public Socket fd() + { + Debug.Assert(_fd != null); + return _fd; + } + + public void close() + { + if(_traceLevels.network >= 1) + { + string s = "closing udp connection\n" + ToString(); + _logger.trace(_traceLevels.networkCat, s); + } + + Debug.Assert(_fd != null); + try + { + _fd.Close(); + } + catch(System.IO.IOException) + { + } + _fd = null; + } + + public void shutdown() + { + } + + public void write(BasicStream stream, int timeout) + { + Debug.Assert(_fd != null); + + ByteBuffer buf = stream.prepareWrite(); + + Debug.Assert(buf.position() == 0); + int packetSize = System.Math.Min(_maxPacketSize, _sndSize - _udpOverhead); + if(packetSize < buf.limit()) + { + // + // We don't log a warning here because the client gets an exception anyway. + // + throw new Ice.DatagramLimitException(); + } + + try + { + int remaining = buf.remaining(); + int ret; + try + { + ret = _fd.Send(buf.rawBytes(), 0, remaining, SocketFlags.None); + } + catch(Win32Exception e) + { + if(Network.wouldBlock(e)) + { + if(timeout == 0) + { + throw new Ice.TimeoutException(); + } + ret = 0; + } + else + { + throw; + } + } + if(ret == 0) + { + if(!Network.doPoll(_fd, timeout, Network.PollMode.Write)) + { + throw new Ice.TimeoutException(); + } + ret = _fd.Send(buf.rawBytes(), 0, remaining, SocketFlags.None); + } + if(ret != remaining) + { + throw new Ice.DatagramLimitException(); + } + + if(_traceLevels.network >= 3) + { + string s = "sent " + ret + " bytes via udp\n" + ToString(); + _logger.trace(_traceLevels.networkCat, s); + } + + if(_stats != null) + { + _stats.bytesSent("udp", ret); + } + + buf.position(remaining); + } + catch(SocketException ex) + { + throw new Ice.SocketException(ex); + } + catch(Ice.LocalException) + { + throw; + } + catch(System.Exception ex) + { + throw new Ice.SyscallException(ex); + } + } + + public void read(BasicStream stream, int timeout) + { + Debug.Assert(stream.pos() == 0); + int packetSize = System.Math.Min(_maxPacketSize, _rcvSize - _udpOverhead); + if(packetSize < stream.size()) + { + // + // We log a warning here because this is the server side -- without the + // the warning, there would only be silence. + // + if(_warn) + { + _logger.warning("DatagramLimitException: maximum size of " + packetSize + " exceeded"); + } + throw new Ice.DatagramLimitException(); + } + stream.resize(packetSize, true); + ByteBuffer buf = stream.prepareRead(); + buf.position(0); + + try + { + int ret; + try + { + Debug.Assert(_fd != null); + ret = _fd.Receive(buf.rawBytes(), 0, buf.limit(), SocketFlags.None); + } + catch(Win32Exception e) + { + if(Network.wouldBlock(e)) + { + if(timeout == 0) + { + throw new Ice.TimeoutException(); + } + ret = 0; + } + else + { + throw; + } + } + if(ret == 0) + { + if(!Network.doPoll(_fd, timeout, Network.PollMode.Read)) + { + throw new Ice.TimeoutException(); + } + ret = _fd.Receive(buf.rawBytes(), 0, buf.limit(), SocketFlags.None); + Debug.Assert(ret != 0); + } + if(_connect) + { + // + // If we must connect, then we connect to the first peer that + // sends us a packet. + // + if(ret != 0) + { + Network.doConnect(_fd, _fd.RemoteEndPoint, -1); + _connect = false; // We're connected now + + if(_traceLevels.network >= 1) + { + string s = "connected udp socket\n" + ToString(); + _logger.trace(_traceLevels.networkCat, s); + } + } + } + if(_traceLevels.network >= 3) + { + string s = "received " + ret + " bytes via udp\n" + ToString(); + _logger.trace(_traceLevels.networkCat, s); + } + + if(_stats != null) + { + _stats.bytesReceived("udp", ret); + } + + stream.resize(ret, true); + } + catch(SocketException ex) + { + throw new Ice.SocketException(ex); + } + catch(Ice.LocalException) + { + throw; + } + catch(System.Exception ex) + { + throw new Ice.SyscallException(ex); + } + } + + public override string ToString() + { + return Network.fdToString(_fd); + } + + public bool equivalent(string host, int port) + { + IPEndPoint addr = ((IPEndPoint)Network.getAddress(host, port)); + return addr.Equals(_addr); + } + + public int effectivePort() + { + return _addr.Port; + } + + // + // Only for use by UdpEndpoint + // + internal UdpTransceiver(Instance instance, string host, int port) + { + _traceLevels = instance.traceLevels(); + _logger = instance.logger(); + _stats = instance.stats(); + _connect = true; + _warn = instance.properties().getPropertyAsInt("Ice.Warn.Datagrams") > 0; + + try + { + _fd = Network.createSocket(true); + setBufSize(instance); + Network.setBlock(_fd, false); + _addr = Network.getAddress(host, port); + Network.doConnect(_fd, _addr, -1); + _connect = false; // We're connected now + + if(_traceLevels.network >= 1) + { + string s = "starting to send udp packets\n" + ToString(); + _logger.trace(_traceLevels.networkCat, s); + } + } + catch(Ice.LocalException ex) + { + _fd = null; + throw ex; + } + } + + // + // Only for use by UdpEndpoint + // + internal UdpTransceiver(Instance instance, string host, int port, bool connect) + { + _traceLevels = instance.traceLevels(); + _logger = instance.logger(); + _stats = instance.stats(); + _connect = connect; + _warn = instance.properties().getPropertyAsInt("Ice.Warn.Datagrams") > 0; + + try + { + _fd = Network.createSocket(true); + setBufSize(instance); + Network.setBlock(_fd, false); + _addr = Network.getAddress(host, port); + if(_traceLevels.network >= 2) + { + string s = "attempting to bind to udp socket " + Network.addrToString(_addr); + _logger.trace(_traceLevels.networkCat, s); + } + _addr = Network.doBind(_fd, _addr); + + if(_traceLevels.network >= 1) + { + string s = "starting to receive udp packets\n" + ToString(); + _logger.trace(_traceLevels.networkCat, s); + } + } + catch(Ice.LocalException ex) + { + _fd = null; + throw ex; + } + } + + private void setBufSize(Instance instance) + { + lock(this) + { + Debug.Assert(_fd != null); + + for (int i = 0; i < 2; ++i) + { + string direction; + string prop; + int dfltSize; + if(i == 0) + { + direction = "receive"; + prop = "Ice.UDP.RcvSize"; + dfltSize = Network.getRecvBufferSize(_fd); + _rcvSize = dfltSize; + } + else + { + direction = "send"; + prop = "Ice.UDP.SndSize"; + dfltSize = Network.getSendBufferSize(_fd); + _sndSize = dfltSize; + } + + // + // Get property for buffer size and check for sanity. + // + int sizeRequested = instance.properties().getPropertyAsIntWithDefault(prop, dfltSize); + if(sizeRequested < _udpOverhead) + { + _logger.warning("Invalid " + prop + " value of " + sizeRequested + " adjusted to " + dfltSize); + sizeRequested = dfltSize; + } + + // + // Ice.MessageSizeMax overrides UDP buffer sizes if Ice.MessageSizeMax + _udpOverhead is less. + // + int messageSizeMax = instance.messageSizeMax(); + if(sizeRequested > messageSizeMax + _udpOverhead) + { + int newSize = System.Math.Min(messageSizeMax, _maxPacketSize) + _udpOverhead; + _logger.warning("UDP " + direction + " buffer size: request size of " + sizeRequested + " adjusted to " + + newSize + " (Ice.MessageSizeMax takes precendence)"); + sizeRequested = newSize; + } + + if(sizeRequested != dfltSize) + { + // + // Try to set the buffer size. The kernel will silently adjust + // the size to an acceptable value. Then read the size back to + // get the size that was actually set. + // + int sizeSet; + if(i == 0) + { + Network.setRecvBufferSize(_fd, sizeRequested); + _rcvSize = Network.getRecvBufferSize(_fd); + sizeSet = _rcvSize; + } + else + { + Network.setSendBufferSize(_fd, sizeRequested); + _sndSize = Network.getSendBufferSize(_fd); + sizeSet = _sndSize; + } + + // + // Warn if the size that was set is less than the requested size. + // + if(sizeSet < sizeRequested) + { + _logger.warning("UDP " + direction + " buffer size: requested size of " + sizeRequested + " adjusted to " + sizeSet); + } + } + } + } + } + + + ~UdpTransceiver() + { + Debug.Assert(_fd == null); + } + + private TraceLevels _traceLevels; + private Ice.Logger _logger; + private Ice.Stats _stats; + private bool _connect; + private readonly bool _warn; + private int _rcvSize; + private int _sndSize; + private Socket _fd; + private IPEndPoint _addr; + + // + // The maximum IP datagram size is 65535. Subtract 20 bytes for the IP header and 8 bytes for the UDP header + // to get the maximum payload. + // + private const int _udpOverhead = 20 + 8; + private static readonly int _maxPacketSize = 65535 - _udpOverhead; + } + +} diff --git a/cs/src/Ice/UnknownEndpoint.cs b/cs/src/Ice/UnknownEndpoint.cs index adbe303719e..15f81a364bf 100755 --- a/cs/src/Ice/UnknownEndpoint.cs +++ b/cs/src/Ice/UnknownEndpoint.cs @@ -7,247 +7,247 @@ // // ********************************************************************** -
-namespace IceInternal
-{
-
- sealed class UnknownEndpoint : Endpoint
- {
- public UnknownEndpoint(short type, BasicStream s)
- {
- _instance = s.instance();
- _type = type;
- s.startReadEncaps();
- int sz = s.getReadEncapsSize();
- _rawBytes = new byte[sz];
- s.readBlob(_rawBytes);
- s.endReadEncaps();
- calcHashValue();
- }
-
- //
- // Marshal the endpoint
- //
- public void streamWrite(BasicStream s)
- {
- s.writeShort(_type);
- s.startWriteEncaps();
- s.writeBlob(_rawBytes);
- s.endWriteEncaps();
- }
-
- //
- // Convert the endpoint to its string form
- //
- public override string ToString()
- {
- return "";
- }
-
- //
- // Return the endpoint type
- //
- public short type()
- {
- return _type;
- }
-
- //
- // Return the timeout for the endpoint in milliseconds. 0 means
- // non-blocking, -1 means no timeout.
- //
- public int timeout()
- {
- return -1;
- }
-
- //
- // Return a new endpoint with a different timeout value, provided
- // that timeouts are supported by the endpoint. Otherwise the same
- // endpoint is returned.
- //
- public Endpoint timeout(int t)
- {
- return this;
- }
-
- //
- // Return true if the endpoints support bzip2 compress, or false
- // otherwise.
- //
- public bool compress()
- {
- return false;
- }
-
- //
- // Return a new endpoint with a different compression value,
- // provided that compression is supported by the
- // endpoint. Otherwise the same endpoint is returned.
- //
- public Endpoint compress(bool compress)
- {
- return this;
- }
-
- //
- // Return true if the endpoint is datagram-based.
- //
- public bool datagram()
- {
- return false;
- }
-
- //
- // Return true if the endpoint is secure.
- //
- public bool secure()
- {
- return false;
- }
-
- //
- // Return true if the endpoint type is unknown.
- //
- public bool unknown()
- {
- return true;
- }
-
- //
- // Return a client side transceiver for this endpoint, or null if a
- // transceiver can only be created by a connector.
- //
- public Transceiver clientTransceiver()
- {
- return null;
- }
-
- //
- // Return a server side transceiver for this endpoint, or null if a
- // transceiver can only be created by an acceptor. In case a
- // transceiver is created, this operation also returns a new
- // "effective" endpoint, which might differ from this endpoint,
- // for example, if a dynamic port number is assigned.
- //
- public Transceiver serverTransceiver(ref Endpoint endpoint)
- {
- endpoint = null;
- return null;
- }
-
- //
- // Return a connector for this endpoint, or null if no connector
- // is available.
- //
- public Connector connector()
- {
- return null;
- }
-
- //
- // Return an acceptor for this endpoint, or null if no acceptors
- // is available. In case an acceptor is created, this operation
- // also returns a new "effective" endpoint, which might differ
- // from this endpoint, for example, if a dynamic port number is
- // assigned.
- //
- public Acceptor acceptor(ref Endpoint endpoint)
- {
- endpoint = null;
- return null;
- }
-
- //
- // Check whether the endpoint is equivalent to a specific
- // Transceiver or Acceptor
- //
- public bool equivalent(Transceiver transceiver)
- {
- return false;
- }
-
- public bool equivalent(Acceptor acceptor)
- {
- return false;
- }
-
- public override int GetHashCode()
- {
- return _hashCode;
- }
-
- //
- // Compare endpoints for sorting purposes
- //
- public override bool Equals(System.Object obj)
- {
- return CompareTo(obj) == 0;
- }
-
- public int CompareTo(System.Object obj)
- {
- UnknownEndpoint p = null;
-
- try
- {
- p = (UnknownEndpoint) obj;
- }
- catch(System.InvalidCastException)
- {
- return 1;
- }
-
- if(this == p)
- {
- return 0;
- }
-
- if(_type < p._type)
- {
- return -1;
- }
- else if(p._type < _type)
- {
- return 1;
- }
-
- if(_rawBytes.Length < p._rawBytes.Length)
- {
- return -1;
- }
- else if(p._rawBytes.Length < _rawBytes.Length)
- {
- return 1;
- }
- for(int i = 0; i < _rawBytes.Length; i++)
- {
- if(_rawBytes[i] < p._rawBytes[i])
- {
- return -1;
- }
- else if(p._rawBytes[i] < _rawBytes[i])
- {
- return 1;
- }
- }
-
- return 0;
- }
-
- private void calcHashValue()
- {
- _hashCode = _type;
- for(int i = 0; i < _rawBytes.Length; i++)
- {
- _hashCode = 5 * _hashCode + _rawBytes[i];
- }
- }
-
- private Instance _instance;
- private short _type;
- private byte[] _rawBytes;
- private int _hashCode;
- }
-
-}
+ +namespace IceInternal +{ + + sealed class UnknownEndpoint : Endpoint + { + public UnknownEndpoint(short type, BasicStream s) + { + _instance = s.instance(); + _type = type; + s.startReadEncaps(); + int sz = s.getReadEncapsSize(); + _rawBytes = new byte[sz]; + s.readBlob(_rawBytes); + s.endReadEncaps(); + calcHashValue(); + } + + // + // Marshal the endpoint + // + public void streamWrite(BasicStream s) + { + s.writeShort(_type); + s.startWriteEncaps(); + s.writeBlob(_rawBytes); + s.endWriteEncaps(); + } + + // + // Convert the endpoint to its string form + // + public override string ToString() + { + return ""; + } + + // + // Return the endpoint type + // + public short type() + { + return _type; + } + + // + // Return the timeout for the endpoint in milliseconds. 0 means + // non-blocking, -1 means no timeout. + // + public int timeout() + { + return -1; + } + + // + // Return a new endpoint with a different timeout value, provided + // that timeouts are supported by the endpoint. Otherwise the same + // endpoint is returned. + // + public Endpoint timeout(int t) + { + return this; + } + + // + // Return true if the endpoints support bzip2 compress, or false + // otherwise. + // + public bool compress() + { + return false; + } + + // + // Return a new endpoint with a different compression value, + // provided that compression is supported by the + // endpoint. Otherwise the same endpoint is returned. + // + public Endpoint compress(bool compress) + { + return this; + } + + // + // Return true if the endpoint is datagram-based. + // + public bool datagram() + { + return false; + } + + // + // Return true if the endpoint is secure. + // + public bool secure() + { + return false; + } + + // + // Return true if the endpoint type is unknown. + // + public bool unknown() + { + return true; + } + + // + // Return a client side transceiver for this endpoint, or null if a + // transceiver can only be created by a connector. + // + public Transceiver clientTransceiver() + { + return null; + } + + // + // Return a server side transceiver for this endpoint, or null if a + // transceiver can only be created by an acceptor. In case a + // transceiver is created, this operation also returns a new + // "effective" endpoint, which might differ from this endpoint, + // for example, if a dynamic port number is assigned. + // + public Transceiver serverTransceiver(ref Endpoint endpoint) + { + endpoint = null; + return null; + } + + // + // Return a connector for this endpoint, or null if no connector + // is available. + // + public Connector connector() + { + return null; + } + + // + // Return an acceptor for this endpoint, or null if no acceptors + // is available. In case an acceptor is created, this operation + // also returns a new "effective" endpoint, which might differ + // from this endpoint, for example, if a dynamic port number is + // assigned. + // + public Acceptor acceptor(ref Endpoint endpoint) + { + endpoint = null; + return null; + } + + // + // Check whether the endpoint is equivalent to a specific + // Transceiver or Acceptor + // + public bool equivalent(Transceiver transceiver) + { + return false; + } + + public bool equivalent(Acceptor acceptor) + { + return false; + } + + public override int GetHashCode() + { + return _hashCode; + } + + // + // Compare endpoints for sorting purposes + // + public override bool Equals(System.Object obj) + { + return CompareTo(obj) == 0; + } + + public int CompareTo(System.Object obj) + { + UnknownEndpoint p = null; + + try + { + p = (UnknownEndpoint) obj; + } + catch(System.InvalidCastException) + { + return 1; + } + + if(this == p) + { + return 0; + } + + if(_type < p._type) + { + return -1; + } + else if(p._type < _type) + { + return 1; + } + + if(_rawBytes.Length < p._rawBytes.Length) + { + return -1; + } + else if(p._rawBytes.Length < _rawBytes.Length) + { + return 1; + } + for(int i = 0; i < _rawBytes.Length; i++) + { + if(_rawBytes[i] < p._rawBytes[i]) + { + return -1; + } + else if(p._rawBytes[i] < _rawBytes[i]) + { + return 1; + } + } + + return 0; + } + + private void calcHashValue() + { + _hashCode = _type; + for(int i = 0; i < _rawBytes.Length; i++) + { + _hashCode = 5 * _hashCode + _rawBytes[i]; + } + } + + private Instance _instance; + private short _type; + private byte[] _rawBytes; + private int _hashCode; + } + +} diff --git a/cs/src/Ice/UserExceptionFactory.cs b/cs/src/Ice/UserExceptionFactory.cs index 972dc5904f3..eebe39c79df 100755 --- a/cs/src/Ice/UserExceptionFactory.cs +++ b/cs/src/Ice/UserExceptionFactory.cs @@ -7,14 +7,14 @@ // // ********************************************************************** -
-namespace IceInternal
-{
-
- public interface UserExceptionFactory
- {
- void createAndThrow();
- void destroy();
-}
-
-}
+ +namespace IceInternal +{ + + public interface UserExceptionFactory + { + void createAndThrow(); + void destroy(); +} + +} diff --git a/cs/src/IceUtil/LinkedList.cs b/cs/src/IceUtil/LinkedList.cs index 4cddbf17f36..1c69db98cd6 100755 --- a/cs/src/IceUtil/LinkedList.cs +++ b/cs/src/IceUtil/LinkedList.cs @@ -188,101 +188,101 @@ public class LinkedList : ICollection, ICloneable private Node _tail; private int _count; - public class Enumerator : IEnumerator
- {
- internal
- Enumerator(LinkedList list)
- {
- _list = list;
- _current = null;
- _movePrev = null;
- _moveNext = null;
- _removed = false;
- }
-
- public void
- Reset()
- {
- _current = null;
- _movePrev = null;
- _moveNext = null;
- _removed = false;
- }
-
- public object
- Current
- {
- get
- {
- if(_current == null)
- {
- throw new InvalidOperationException("iterator not positioned on an element");
- }
- return _current.val;
- }
- }
-
- public bool
- MoveNext()
- {
- if(_removed)
- {
- _current = _moveNext;
- _moveNext = null;
- _movePrev = null;
- _removed = false;
- }
- else
- {
- if(_current == _list._tail) // Make sure the iterator "sticks" if on last element.
- {
- return false;
- }
- _current = _current == null ? _list._head : _current.next;
- }
- return _current != null;
- }
-
- public bool
- MovePrev()
- {
- if(_removed)
- {
- _current = _movePrev;
- _movePrev = null;
- _moveNext = null;
- _removed = false;
- }
- else
- {
- if(_current == _list._head) // Make sure the iterator "sticks" if on first element.
- {
- return false;
- }
- _current = _current == null ? _list._tail : _current.prev;
- }
- return _current != null;
- }
-
- public void
- Remove()
- {
- if(_current == null)
- {
- throw new InvalidOperationException("iterator is not positioned on an element");
- }
- _removed = true;
- _moveNext = _current.next; // Remember where to move next for call to MoveNext().
- _movePrev = _current.prev; // Remember where to move next for call to MovePrev().
- _list.Remove(_current);
- _current = null;
- }
-
- private LinkedList _list; // The list we are iterating over.
- private Node _current; // Current iterator position.
- private Node _moveNext; // Remembers node that preceded a removed element.
- private Node _movePrev; // Remembers node that followed a removed element.
- private bool _removed; // True after a call to Remove(), false otherwise.
+ public class Enumerator : IEnumerator + { + internal + Enumerator(LinkedList list) + { + _list = list; + _current = null; + _movePrev = null; + _moveNext = null; + _removed = false; + } + + public void + Reset() + { + _current = null; + _movePrev = null; + _moveNext = null; + _removed = false; + } + + public object + Current + { + get + { + if(_current == null) + { + throw new InvalidOperationException("iterator not positioned on an element"); + } + return _current.val; + } + } + + public bool + MoveNext() + { + if(_removed) + { + _current = _moveNext; + _moveNext = null; + _movePrev = null; + _removed = false; + } + else + { + if(_current == _list._tail) // Make sure the iterator "sticks" if on last element. + { + return false; + } + _current = _current == null ? _list._head : _current.next; + } + return _current != null; + } + + public bool + MovePrev() + { + if(_removed) + { + _current = _movePrev; + _movePrev = null; + _moveNext = null; + _removed = false; + } + else + { + if(_current == _list._head) // Make sure the iterator "sticks" if on first element. + { + return false; + } + _current = _current == null ? _list._tail : _current.prev; + } + return _current != null; + } + + public void + Remove() + { + if(_current == null) + { + throw new InvalidOperationException("iterator is not positioned on an element"); + } + _removed = true; + _moveNext = _current.next; // Remember where to move next for call to MoveNext(). + _movePrev = _current.prev; // Remember where to move next for call to MovePrev(). + _list.Remove(_current); + _current = null; + } + + private LinkedList _list; // The list we are iterating over. + private Node _current; // Current iterator position. + private Node _moveNext; // Remembers node that preceded a removed element. + private Node _movePrev; // Remembers node that followed a removed element. + private bool _removed; // True after a call to Remove(), false otherwise. } } diff --git a/cs/src/IceUtil/OutputBase.cs b/cs/src/IceUtil/OutputBase.cs index cfd614f9b24..b0b2694c352 100755 --- a/cs/src/IceUtil/OutputBase.cs +++ b/cs/src/IceUtil/OutputBase.cs @@ -7,188 +7,188 @@ // // ********************************************************************** -
-namespace IceUtil
-{
-
-using System.Collections;
-using System.IO;
-using System.Diagnostics;
-
-public class OutputBase
-{
- public
- OutputBase()
- {
- _out = null;
- _pos = 0;
- _indent = 0;
- _indentSize = 4;
- _useTab = true;
- _indentSave = new Stack();
- _separator = true;
- }
-
- public
- OutputBase(StreamWriter writer)
- {
- _out = writer;
- _pos = 0;
- _indent = 0;
- _indentSize = 4;
- _useTab = true;
- _indentSave = new Stack();
- _separator = true;
- }
-
- public
- OutputBase(string s)
- {
- _out = new StreamWriter(s);
- _pos = 0;
- _indent = 0;
- _indentSize = 4;
- _useTab = true;
- _indentSave = new Stack();
- _separator = true;
- }
-
- virtual public void
- setIndent(int indentSize)
- {
- _indentSize = indentSize;
- }
-
- virtual public void
- setUseTab(bool useTab)
- {
- _useTab = useTab;
- }
-
- public virtual void
- open(string s)
- {
- try
- {
- _out = new StreamWriter(s);
- }
- catch(IOException)
- {
- }
- }
-
- public virtual void
- print(string s)
- {
- char[] arr = s.ToCharArray();
- for(int i = 0; i < arr.Length; i++)
- {
- if(arr[i] == '\n')
- {
- _pos = 0;
- }
- else
- {
- }
- }
-
- _out.Write(s);
- }
-
- public virtual void
- inc()
- {
- _indent += _indentSize;
- }
-
- public virtual void
- dec()
- {
- Debug.Assert(_indent >= _indentSize);
- _indent -= _indentSize;
- }
-
- public virtual void
- useCurrentPosAsIndent()
- {
- _indentSave.Push(_indent);
- _indent = _pos;
- }
-
- public virtual void
- zeroIndent()
- {
- _indentSave.Push(_indent);
- _indent = 0;
- }
-
- public virtual void
- restoreIndent()
- {
- Debug.Assert(_indentSave.Count != 0);
- _indent = (int)_indentSave.Pop();
- }
-
- public virtual void
- nl()
- {
- _out.WriteLine();
- _pos = 0;
- _separator = true;
-
- int indent = _indent;
-
- if(_useTab)
- {
- while(indent >= 8)
- {
- indent -= 8;
- _out.Write('\t');
- _pos += 8;
- }
- }
- else
- {
- while(indent >= _indentSize)
- {
- indent -= _indentSize;
- _out.Write(" ");
- _pos += _indentSize;
- }
- }
-
- while(indent > 0)
- {
- --indent;
- _out.Write(" ");
- ++_pos;
- }
-
- _out.Flush();
- }
-
- public virtual void
- sp()
- {
- if(_separator)
- {
- _out.WriteLine();
- }
- }
-
- public virtual bool
- valid()
- {
- return _out != null;
- }
-
- protected internal StreamWriter _out;
- protected internal int _pos;
- protected internal int _indent;
- protected internal int _indentSize;
- protected internal Stack _indentSave;
- protected internal bool _useTab;
- protected internal bool _separator;
-}
-
-}
\ No newline at end of file + +namespace IceUtil +{ + +using System.Collections; +using System.IO; +using System.Diagnostics; + +public class OutputBase +{ + public + OutputBase() + { + _out = null; + _pos = 0; + _indent = 0; + _indentSize = 4; + _useTab = true; + _indentSave = new Stack(); + _separator = true; + } + + public + OutputBase(StreamWriter writer) + { + _out = writer; + _pos = 0; + _indent = 0; + _indentSize = 4; + _useTab = true; + _indentSave = new Stack(); + _separator = true; + } + + public + OutputBase(string s) + { + _out = new StreamWriter(s); + _pos = 0; + _indent = 0; + _indentSize = 4; + _useTab = true; + _indentSave = new Stack(); + _separator = true; + } + + virtual public void + setIndent(int indentSize) + { + _indentSize = indentSize; + } + + virtual public void + setUseTab(bool useTab) + { + _useTab = useTab; + } + + public virtual void + open(string s) + { + try + { + _out = new StreamWriter(s); + } + catch(IOException) + { + } + } + + public virtual void + print(string s) + { + char[] arr = s.ToCharArray(); + for(int i = 0; i < arr.Length; i++) + { + if(arr[i] == '\n') + { + _pos = 0; + } + else + { + } + } + + _out.Write(s); + } + + public virtual void + inc() + { + _indent += _indentSize; + } + + public virtual void + dec() + { + Debug.Assert(_indent >= _indentSize); + _indent -= _indentSize; + } + + public virtual void + useCurrentPosAsIndent() + { + _indentSave.Push(_indent); + _indent = _pos; + } + + public virtual void + zeroIndent() + { + _indentSave.Push(_indent); + _indent = 0; + } + + public virtual void + restoreIndent() + { + Debug.Assert(_indentSave.Count != 0); + _indent = (int)_indentSave.Pop(); + } + + public virtual void + nl() + { + _out.WriteLine(); + _pos = 0; + _separator = true; + + int indent = _indent; + + if(_useTab) + { + while(indent >= 8) + { + indent -= 8; + _out.Write('\t'); + _pos += 8; + } + } + else + { + while(indent >= _indentSize) + { + indent -= _indentSize; + _out.Write(" "); + _pos += _indentSize; + } + } + + while(indent > 0) + { + --indent; + _out.Write(" "); + ++_pos; + } + + _out.Flush(); + } + + public virtual void + sp() + { + if(_separator) + { + _out.WriteLine(); + } + } + + public virtual bool + valid() + { + return _out != null; + } + + protected internal StreamWriter _out; + protected internal int _pos; + protected internal int _indent; + protected internal int _indentSize; + protected internal Stack _indentSave; + protected internal bool _useTab; + protected internal bool _separator; +} + +} diff --git a/cs/test/Ice/adapterDeactivation/CookieI.cs b/cs/test/Ice/adapterDeactivation/CookieI.cs index af63d801625..682e64e5b6a 100755 --- a/cs/test/Ice/adapterDeactivation/CookieI.cs +++ b/cs/test/Ice/adapterDeactivation/CookieI.cs @@ -7,11 +7,11 @@ // // ********************************************************************** -
-public sealed class CookieI : Cookie
-{
- public override string message()
- {
- return "blahblah";
- }
-}
+ +public sealed class CookieI : Cookie +{ + public override string message() + { + return "blahblah"; + } +} diff --git a/cs/test/Ice/adapterDeactivation/ServantLocatorI.cs b/cs/test/Ice/adapterDeactivation/ServantLocatorI.cs index d4e934c45a9..b25a51c25ec 100755 --- a/cs/test/Ice/adapterDeactivation/ServantLocatorI.cs +++ b/cs/test/Ice/adapterDeactivation/ServantLocatorI.cs @@ -7,55 +7,55 @@ // // ********************************************************************** -
-using System;
-
-public sealed class ServantLocatorI : Ice.LocalObjectImpl, Ice.ServantLocator
-{
- public ServantLocatorI()
- {
- _deactivated = false;
- }
-
- ~ServantLocatorI()
- {
- test(_deactivated);
- }
-
- private static void test(bool b)
- {
- if(!b)
- {
- throw new System.Exception();
- }
- }
-
- public Ice.Object locate(Ice.Current current, out Ice.LocalObject cookie)
- {
- test(!_deactivated);
-
- test(current.id.category.Length == 0);
- test(current.id.name.Equals("test"));
-
- cookie = new CookieI();
-
- return new TestI();
- }
-
- public void finished(Ice.Current current, Ice.Object servant, Ice.LocalObject cookie)
- {
- test(!_deactivated);
-
- Cookie co = (Cookie) cookie;
- test(co.message().Equals("blahblah"));
- }
-
- public void deactivate(string category)
- {
- test(!_deactivated);
-
- _deactivated = true;
- }
-
- private bool _deactivated;
-}
+ +using System; + +public sealed class ServantLocatorI : Ice.LocalObjectImpl, Ice.ServantLocator +{ + public ServantLocatorI() + { + _deactivated = false; + } + + ~ServantLocatorI() + { + test(_deactivated); + } + + private static void test(bool b) + { + if(!b) + { + throw new System.Exception(); + } + } + + public Ice.Object locate(Ice.Current current, out Ice.LocalObject cookie) + { + test(!_deactivated); + + test(current.id.category.Length == 0); + test(current.id.name.Equals("test")); + + cookie = new CookieI(); + + return new TestI(); + } + + public void finished(Ice.Current current, Ice.Object servant, Ice.LocalObject cookie) + { + test(!_deactivated); + + Cookie co = (Cookie) cookie; + test(co.message().Equals("blahblah")); + } + + public void deactivate(string category) + { + test(!_deactivated); + + _deactivated = true; + } + + private bool _deactivated; +} diff --git a/cs/test/Ice/adapterDeactivation/Server.cs b/cs/test/Ice/adapterDeactivation/Server.cs index e6fcfd4d4a9..becba30b16e 100755 --- a/cs/test/Ice/adapterDeactivation/Server.cs +++ b/cs/test/Ice/adapterDeactivation/Server.cs @@ -7,27 +7,27 @@ // // ********************************************************************** -
-public class Server
-{
- internal class TestServer : Ice.Application
- {
- public override int run(string[] args)
- {
- communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.ServantLocator locator = new ServantLocatorI();
- adapter.addServantLocator(locator, "");
- adapter.activate();
- adapter.waitForDeactivate();
- return 0;
- }
- }
-
- public static void Main(string[] args)
- {
- TestServer app = new TestServer();
- int result = app.main(args);
- System.Environment.Exit(result);
- }
-}
+ +public class Server +{ + internal class TestServer : Ice.Application + { + public override int run(string[] args) + { + communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.ServantLocator locator = new ServantLocatorI(); + adapter.addServantLocator(locator, ""); + adapter.activate(); + adapter.waitForDeactivate(); + return 0; + } + } + + public static void Main(string[] args) + { + TestServer app = new TestServer(); + int result = app.main(args); + System.Environment.Exit(result); + } +} diff --git a/cs/test/Ice/checksum/server/TestI.cs b/cs/test/Ice/checksum/server/TestI.cs index 4ceca9768fc..b098b6c13e5 100755 --- a/cs/test/Ice/checksum/server/TestI.cs +++ b/cs/test/Ice/checksum/server/TestI.cs @@ -1,31 +1,31 @@ -// **********************************************************************
-//
-// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-namespace Test
-{
- public sealed class ChecksumI : _ChecksumDisp
- {
- public ChecksumI(Ice.ObjectAdapter adapter)
- {
- _adapter = adapter;
- }
-
- public override Ice.SliceChecksumDict getSliceChecksums(Ice.Current __current)
- {
- return Ice.SliceChecksums.checksums;
- }
-
- public override void shutdown(Ice.Current __current)
- {
- _adapter.getCommunicator().shutdown();
- }
-
- private Ice.ObjectAdapter _adapter;
- }
-}
+// ********************************************************************** +// +// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +namespace Test +{ + public sealed class ChecksumI : _ChecksumDisp + { + public ChecksumI(Ice.ObjectAdapter adapter) + { + _adapter = adapter; + } + + public override Ice.SliceChecksumDict getSliceChecksums(Ice.Current __current) + { + return Ice.SliceChecksums.checksums; + } + + public override void shutdown(Ice.Current __current) + { + _adapter.getCommunicator().shutdown(); + } + + private Ice.ObjectAdapter _adapter; + } +} diff --git a/cs/test/Ice/exceptions/Client.cs b/cs/test/Ice/exceptions/Client.cs index 24af4dd154d..9c1dfc86680 100755 --- a/cs/test/Ice/exceptions/Client.cs +++ b/cs/test/Ice/exceptions/Client.cs @@ -7,47 +7,47 @@ // // ********************************************************************** -
-public class Client
-{
- private static int
- run(string[] args, Ice.Communicator communicator)
- {
- ThrowerPrx thrower = AllTests.allTests(communicator, false);
- thrower.shutdown();
- return 0;
- }
-
- public static void
- Main(string[] args)
- {
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
- }
-
- System.Environment.Exit(status);
- }
-}
+ +public class Client +{ + private static int + run(string[] args, Ice.Communicator communicator) + { + ThrowerPrx thrower = AllTests.allTests(communicator, false); + thrower.shutdown(); + return 0; + } + + public static void + Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + status = run(args, communicator); + } + catch(System.Exception ex) + { + System.Console.WriteLine(ex); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + System.Console.WriteLine(ex); + status = 1; + } + } + + System.Environment.Exit(status); + } +} diff --git a/cs/test/Ice/exceptions/Collocated.cs b/cs/test/Ice/exceptions/Collocated.cs index b56c54c7d9a..e2c5ee42c47 100755 --- a/cs/test/Ice/exceptions/Collocated.cs +++ b/cs/test/Ice/exceptions/Collocated.cs @@ -7,50 +7,50 @@ // // ********************************************************************** -
-public class Collocated
-{
- private static int
- run(string[] args, Ice.Communicator communicator)
- {
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object obj = new ThrowerI(adapter);
- adapter.add(obj, Ice.Util.stringToIdentity("thrower"));
- AllTests.allTests(communicator, true);
- return 0;
- }
-
- public static void
- Main(string[] args)
- {
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
- }
-
- System.Environment.Exit(status);
- }
-}
+ +public class Collocated +{ + private static int + run(string[] args, Ice.Communicator communicator) + { + communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Object obj = new ThrowerI(adapter); + adapter.add(obj, Ice.Util.stringToIdentity("thrower")); + AllTests.allTests(communicator, true); + return 0; + } + + public static void + Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + status = run(args, communicator); + } + catch(System.Exception ex) + { + System.Console.WriteLine(ex); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + System.Console.WriteLine(ex); + status = 1; + } + } + + System.Environment.Exit(status); + } +} diff --git a/cs/test/Ice/exceptions/EmptyI.cs b/cs/test/Ice/exceptions/EmptyI.cs index 284941cc773..35d48b9dd88 100755 --- a/cs/test/Ice/exceptions/EmptyI.cs +++ b/cs/test/Ice/exceptions/EmptyI.cs @@ -7,7 +7,7 @@ // // ********************************************************************** -
-public sealed class EmptyI : _EmptyDisp
-{
-}
+ +public sealed class EmptyI : _EmptyDisp +{ +} diff --git a/cs/test/Ice/exceptions/ObjectFactoryI.cs b/cs/test/Ice/exceptions/ObjectFactoryI.cs index 206e3fafb92..a187580980e 100755 --- a/cs/test/Ice/exceptions/ObjectFactoryI.cs +++ b/cs/test/Ice/exceptions/ObjectFactoryI.cs @@ -7,15 +7,15 @@ // // ********************************************************************** -
-public sealed class ObjectFactoryI : Ice.LocalObjectImpl, Ice.ObjectFactory
-{
- public Ice.Object create(string s)
- {
- return null;
- }
-
- public void destroy()
- {
- }
-}
+ +public sealed class ObjectFactoryI : Ice.LocalObjectImpl, Ice.ObjectFactory +{ + public Ice.Object create(string s) + { + return null; + } + + public void destroy() + { + } +} diff --git a/cs/test/Ice/exceptions/ServantLocatorI.cs b/cs/test/Ice/exceptions/ServantLocatorI.cs index 298f12b55c2..13f399344b2 100755 --- a/cs/test/Ice/exceptions/ServantLocatorI.cs +++ b/cs/test/Ice/exceptions/ServantLocatorI.cs @@ -7,20 +7,20 @@ // // ********************************************************************** -
-public sealed class ServantLocatorI : Ice.LocalObjectImpl, Ice.ServantLocator
-{
- public Ice.Object locate(Ice.Current curr, out Ice.LocalObject cookie)
- {
- cookie = null;
- return null;
- }
-
- public void finished(Ice.Current curr, Ice.Object servant, Ice.LocalObject cookie)
- {
- }
-
- public void deactivate(string category)
- {
- }
-}
+ +public sealed class ServantLocatorI : Ice.LocalObjectImpl, Ice.ServantLocator +{ + public Ice.Object locate(Ice.Current curr, out Ice.LocalObject cookie) + { + cookie = null; + return null; + } + + public void finished(Ice.Current curr, Ice.Object servant, Ice.LocalObject cookie) + { + } + + public void deactivate(string category) + { + } +} diff --git a/cs/test/Ice/facets/AI.cs b/cs/test/Ice/facets/AI.cs index 34507517a61..2fdf8b170e9 100755 --- a/cs/test/Ice/facets/AI.cs +++ b/cs/test/Ice/facets/AI.cs @@ -7,15 +7,15 @@ // // ********************************************************************** -
-public sealed class AI : _ADisp
-{
- public AI()
- {
- }
-
- public override string callA(Ice.Current current)
- {
- return "A";
- }
-}
+ +public sealed class AI : _ADisp +{ + public AI() + { + } + + public override string callA(Ice.Current current) + { + return "A"; + } +} diff --git a/cs/test/Ice/facets/BI.cs b/cs/test/Ice/facets/BI.cs index f8f6bc17183..d5a37e3bd37 100755 --- a/cs/test/Ice/facets/BI.cs +++ b/cs/test/Ice/facets/BI.cs @@ -7,20 +7,20 @@ // // ********************************************************************** -
-public sealed class BI : _BDisp
-{
- public BI()
- {
- }
-
- public override string callA(Ice.Current current)
- {
- return "A";
- }
-
- public override string callB(Ice.Current current)
- {
- return "B";
- }
-}
+ +public sealed class BI : _BDisp +{ + public BI() + { + } + + public override string callA(Ice.Current current) + { + return "A"; + } + + public override string callB(Ice.Current current) + { + return "B"; + } +} diff --git a/cs/test/Ice/facets/CI.cs b/cs/test/Ice/facets/CI.cs index 6eae27770eb..8c98515572f 100755 --- a/cs/test/Ice/facets/CI.cs +++ b/cs/test/Ice/facets/CI.cs @@ -7,20 +7,20 @@ // // ********************************************************************** -
-public sealed class CI : _CDisp
-{
- public CI()
- {
- }
-
- public override string callA(Ice.Current current)
- {
- return "A";
- }
-
- public override string callC(Ice.Current current)
- {
- return "C";
- }
-}
+ +public sealed class CI : _CDisp +{ + public CI() + { + } + + public override string callA(Ice.Current current) + { + return "A"; + } + + public override string callC(Ice.Current current) + { + return "C"; + } +} diff --git a/cs/test/Ice/facets/Client.cs b/cs/test/Ice/facets/Client.cs index 031635bb05d..f98c6ad5748 100755 --- a/cs/test/Ice/facets/Client.cs +++ b/cs/test/Ice/facets/Client.cs @@ -7,45 +7,45 @@ // // ********************************************************************** -
-public class Collocated
-{
- private static int run(string[] args, Ice.Communicator communicator)
- {
- GPrx g = AllTests.allTests(communicator);
- g.shutdown();
- return 0;
- }
-
- public static void Main(string[] args)
- {
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
- }
-
- System.Environment.Exit(status);
- }
-}
+ +public class Collocated +{ + private static int run(string[] args, Ice.Communicator communicator) + { + GPrx g = AllTests.allTests(communicator); + g.shutdown(); + return 0; + } + + public static void Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + status = run(args, communicator); + } + catch(System.Exception ex) + { + System.Console.WriteLine(ex); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + System.Console.WriteLine(ex); + status = 1; + } + } + + System.Environment.Exit(status); + } +} diff --git a/cs/test/Ice/facets/Collocated.cs b/cs/test/Ice/facets/Collocated.cs index 203cf04dead..f6e122d78b0 100755 --- a/cs/test/Ice/facets/Collocated.cs +++ b/cs/test/Ice/facets/Collocated.cs @@ -7,55 +7,55 @@ // // ********************************************************************** -
-public class Collocated
-{
- private static int run(string[] args, Ice.Communicator communicator)
- {
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object d = new DI();
- adapter.add(d, Ice.Util.stringToIdentity("d"));
- adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD");
- Ice.Object f = new FI();
- adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF");
- Ice.Object h = new HI(communicator);
- adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH");
-
- AllTests.allTests(communicator);
-
- return 0;
- }
-
- public static void Main(string[] args)
- {
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
- }
-
- System.Environment.Exit(status);
- }
-}
+ +public class Collocated +{ + private static int run(string[] args, Ice.Communicator communicator) + { + communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Object d = new DI(); + adapter.add(d, Ice.Util.stringToIdentity("d")); + adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD"); + Ice.Object f = new FI(); + adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF"); + Ice.Object h = new HI(communicator); + adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH"); + + AllTests.allTests(communicator); + + return 0; + } + + public static void Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + status = run(args, communicator); + } + catch(System.Exception ex) + { + System.Console.WriteLine(ex); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + System.Console.WriteLine(ex); + status = 1; + } + } + + System.Environment.Exit(status); + } +} diff --git a/cs/test/Ice/facets/DI.cs b/cs/test/Ice/facets/DI.cs index c0cb890dbab..83c32bbdb4b 100755 --- a/cs/test/Ice/facets/DI.cs +++ b/cs/test/Ice/facets/DI.cs @@ -7,30 +7,30 @@ // // ********************************************************************** -
-public sealed class DI : _DDisp
-{
- public DI()
- {
- }
-
- public override string callA(Ice.Current current)
- {
- return "A";
- }
-
- public override string callB(Ice.Current current)
- {
- return "B";
- }
-
- public override string callC(Ice.Current current)
- {
- return "C";
- }
-
- public override string callD(Ice.Current current)
- {
- return "D";
- }
-}
+ +public sealed class DI : _DDisp +{ + public DI() + { + } + + public override string callA(Ice.Current current) + { + return "A"; + } + + public override string callB(Ice.Current current) + { + return "B"; + } + + public override string callC(Ice.Current current) + { + return "C"; + } + + public override string callD(Ice.Current current) + { + return "D"; + } +} diff --git a/cs/test/Ice/facets/EI.cs b/cs/test/Ice/facets/EI.cs index 0049c896ac4..9d4a62a13ab 100755 --- a/cs/test/Ice/facets/EI.cs +++ b/cs/test/Ice/facets/EI.cs @@ -7,15 +7,15 @@ // // ********************************************************************** -
-public sealed class EI : _EDisp
-{
- public EI()
- {
- }
-
- public override string callE(Ice.Current current)
- {
- return "E";
- }
-}
+ +public sealed class EI : _EDisp +{ + public EI() + { + } + + public override string callE(Ice.Current current) + { + return "E"; + } +} diff --git a/cs/test/Ice/facets/EmptyI.cs b/cs/test/Ice/facets/EmptyI.cs index 284941cc773..35d48b9dd88 100755 --- a/cs/test/Ice/facets/EmptyI.cs +++ b/cs/test/Ice/facets/EmptyI.cs @@ -7,7 +7,7 @@ // // ********************************************************************** -
-public sealed class EmptyI : _EmptyDisp
-{
-}
+ +public sealed class EmptyI : _EmptyDisp +{ +} diff --git a/cs/test/Ice/facets/FI.cs b/cs/test/Ice/facets/FI.cs index c785683c531..8778d95b1ae 100755 --- a/cs/test/Ice/facets/FI.cs +++ b/cs/test/Ice/facets/FI.cs @@ -7,20 +7,20 @@ // // ********************************************************************** -
-public sealed class FI : _FDisp
-{
- public FI()
- {
- }
-
- public override string callE(Ice.Current current)
- {
- return "E";
- }
-
- public override string callF(Ice.Current current)
- {
- return "F";
- }
-}
+ +public sealed class FI : _FDisp +{ + public FI() + { + } + + public override string callE(Ice.Current current) + { + return "E"; + } + + public override string callF(Ice.Current current) + { + return "F"; + } +} diff --git a/cs/test/Ice/facets/GI.cs b/cs/test/Ice/facets/GI.cs index 7b0821ad90e..3db63aef3e1 100755 --- a/cs/test/Ice/facets/GI.cs +++ b/cs/test/Ice/facets/GI.cs @@ -7,23 +7,23 @@ // // ********************************************************************** -
-public sealed class GI : _GDisp
-{
- public GI(Ice.Communicator communicator)
- {
- _communicator = communicator;
- }
-
- public override string callG(Ice.Current current)
- {
- return "G";
- }
-
- public override void shutdown(Ice.Current current)
- {
- _communicator.shutdown();
- }
-
- private Ice.Communicator _communicator;
-}
+ +public sealed class GI : _GDisp +{ + public GI(Ice.Communicator communicator) + { + _communicator = communicator; + } + + public override string callG(Ice.Current current) + { + return "G"; + } + + public override void shutdown(Ice.Current current) + { + _communicator.shutdown(); + } + + private Ice.Communicator _communicator; +} diff --git a/cs/test/Ice/facets/HI.cs b/cs/test/Ice/facets/HI.cs index 021e81acf60..ac35c51c30c 100755 --- a/cs/test/Ice/facets/HI.cs +++ b/cs/test/Ice/facets/HI.cs @@ -7,28 +7,28 @@ // // ********************************************************************** -
-public sealed class HI : _HDisp
-{
- public HI(Ice.Communicator communicator)
- {
- _communicator = communicator;
- }
-
- public override string callG(Ice.Current current)
- {
- return "G";
- }
-
- public override string callH(Ice.Current current)
- {
- return "H";
- }
-
- public override void shutdown(Ice.Current current)
- {
- _communicator.shutdown();
- }
-
- private Ice.Communicator _communicator;
-}
+ +public sealed class HI : _HDisp +{ + public HI(Ice.Communicator communicator) + { + _communicator = communicator; + } + + public override string callG(Ice.Current current) + { + return "G"; + } + + public override string callH(Ice.Current current) + { + return "H"; + } + + public override void shutdown(Ice.Current current) + { + _communicator.shutdown(); + } + + private Ice.Communicator _communicator; +} diff --git a/cs/test/Ice/facets/Server.cs b/cs/test/Ice/facets/Server.cs index 70bd9c868b7..fb28cea7d09 100755 --- a/cs/test/Ice/facets/Server.cs +++ b/cs/test/Ice/facets/Server.cs @@ -7,56 +7,56 @@ // // ********************************************************************** -
-public class Server
-{
- private static int run(string[] args, Ice.Communicator communicator)
- {
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object d = new DI();
- adapter.add(d, Ice.Util.stringToIdentity("d"));
- adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD");
- Ice.Object f = new FI();
- adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF");
- Ice.Object h = new HI(communicator);
- adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH");
-
- adapter.activate();
- communicator.waitForShutdown();
-
- return 0;
- }
-
- public static void Main(string[] args)
- {
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
- }
-
- System.Environment.Exit(status);
- }
-}
+ +public class Server +{ + private static int run(string[] args, Ice.Communicator communicator) + { + communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Object d = new DI(); + adapter.add(d, Ice.Util.stringToIdentity("d")); + adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD"); + Ice.Object f = new FI(); + adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF"); + Ice.Object h = new HI(communicator); + adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH"); + + adapter.activate(); + communicator.waitForShutdown(); + + return 0; + } + + public static void Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + status = run(args, communicator); + } + catch(System.Exception ex) + { + System.Console.WriteLine(ex); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + System.Console.WriteLine(ex); + status = 1; + } + } + + System.Environment.Exit(status); + } +} diff --git a/cs/test/Ice/inheritance/CAI.cs b/cs/test/Ice/inheritance/CAI.cs index 3815489ee11..cdbdfc9ea84 100755 --- a/cs/test/Ice/inheritance/CAI.cs +++ b/cs/test/Ice/inheritance/CAI.cs @@ -7,15 +7,15 @@ // // ********************************************************************** -
-public sealed class CAI : MA.CA
-{
- public CAI()
- {
- }
-
- public override MA.CAPrx caop(MA.CAPrx p, Ice.Current current)
- {
- return p;
- }
-}
+ +public sealed class CAI : MA.CA +{ + public CAI() + { + } + + public override MA.CAPrx caop(MA.CAPrx p, Ice.Current current) + { + return p; + } +} diff --git a/cs/test/Ice/inheritance/CBI.cs b/cs/test/Ice/inheritance/CBI.cs index d8cb2a0ec55..e8601d92f21 100755 --- a/cs/test/Ice/inheritance/CBI.cs +++ b/cs/test/Ice/inheritance/CBI.cs @@ -7,20 +7,20 @@ // // ********************************************************************** -
-public sealed class CBI : MB.CB
-{
- public CBI()
- {
- }
-
- public override MA.CAPrx caop(MA.CAPrx p, Ice.Current current)
- {
- return p;
- }
-
- public override MB.CBPrx cbop(MB.CBPrx p, Ice.Current current)
- {
- return p;
- }
-}
+ +public sealed class CBI : MB.CB +{ + public CBI() + { + } + + public override MA.CAPrx caop(MA.CAPrx p, Ice.Current current) + { + return p; + } + + public override MB.CBPrx cbop(MB.CBPrx p, Ice.Current current) + { + return p; + } +} diff --git a/cs/test/Ice/inheritance/CCI.cs b/cs/test/Ice/inheritance/CCI.cs index cffebab328c..977de760784 100755 --- a/cs/test/Ice/inheritance/CCI.cs +++ b/cs/test/Ice/inheritance/CCI.cs @@ -7,25 +7,25 @@ // // ********************************************************************** -
-public sealed class CCI : MA.CC
-{
- public CCI()
- {
- }
-
- public override MA.CAPrx caop(MA.CAPrx p, Ice.Current current)
- {
- return p;
- }
-
- public override MA.CCPrx ccop(MA.CCPrx p, Ice.Current current)
- {
- return p;
- }
-
- public override MB.CBPrx cbop(MB.CBPrx p, Ice.Current current)
- {
- return p;
- }
-}
+ +public sealed class CCI : MA.CC +{ + public CCI() + { + } + + public override MA.CAPrx caop(MA.CAPrx p, Ice.Current current) + { + return p; + } + + public override MA.CCPrx ccop(MA.CCPrx p, Ice.Current current) + { + return p; + } + + public override MB.CBPrx cbop(MB.CBPrx p, Ice.Current current) + { + return p; + } +} diff --git a/cs/test/Ice/inheritance/CDI.cs b/cs/test/Ice/inheritance/CDI.cs index fae409434f3..bcb99de3d16 100755 --- a/cs/test/Ice/inheritance/CDI.cs +++ b/cs/test/Ice/inheritance/CDI.cs @@ -7,45 +7,45 @@ // // ********************************************************************** -
-public sealed class CDI : MA.CD
-{
- public CDI()
- {
- }
-
- public override MA.CAPrx caop(MA.CAPrx p, Ice.Current current)
- {
- return p;
- }
-
- public override MA.CCPrx ccop(MA.CCPrx p, Ice.Current current)
- {
- return p;
- }
-
- public override MA.CDPrx cdop(MA.CDPrx p, Ice.Current current)
- {
- return p;
- }
-
- public override MA.IAPrx iaop(MA.IAPrx p, Ice.Current current)
- {
- return p;
- }
-
- public override MB.CBPrx cbop(MB.CBPrx p, Ice.Current current)
- {
- return p;
- }
-
- public override MB.IB1Prx ib1op(MB.IB1Prx p, Ice.Current current)
- {
- return p;
- }
-
- public override MB.IB2Prx ib2op(MB.IB2Prx p, Ice.Current current)
- {
- return p;
- }
-}
+ +public sealed class CDI : MA.CD +{ + public CDI() + { + } + + public override MA.CAPrx caop(MA.CAPrx p, Ice.Current current) + { + return p; + } + + public override MA.CCPrx ccop(MA.CCPrx p, Ice.Current current) + { + return p; + } + + public override MA.CDPrx cdop(MA.CDPrx p, Ice.Current current) + { + return p; + } + + public override MA.IAPrx iaop(MA.IAPrx p, Ice.Current current) + { + return p; + } + + public override MB.CBPrx cbop(MB.CBPrx p, Ice.Current current) + { + return p; + } + + public override MB.IB1Prx ib1op(MB.IB1Prx p, Ice.Current current) + { + return p; + } + + public override MB.IB2Prx ib2op(MB.IB2Prx p, Ice.Current current) + { + return p; + } +} diff --git a/cs/test/Ice/inheritance/Client.cs b/cs/test/Ice/inheritance/Client.cs index 774e5e465e5..e7a9679b9c1 100755 --- a/cs/test/Ice/inheritance/Client.cs +++ b/cs/test/Ice/inheritance/Client.cs @@ -7,45 +7,45 @@ // // ********************************************************************** -
-public class Client
-{
- private static int run(string[] args, Ice.Communicator communicator)
- {
- InitialPrx initial = AllTests.allTests(communicator);
- initial.shutdown();
- return 0;
- }
-
- public static void Main(string[] args)
- {
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- System.Environment.Exit(status);
- }
-}
+ +public class Client +{ + private static int run(string[] args, Ice.Communicator communicator) + { + InitialPrx initial = AllTests.allTests(communicator); + initial.shutdown(); + return 0; + } + + public static void Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + status = run(args, communicator); + } + catch(System.Exception ex) + { + System.Console.Error.WriteLine(ex); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + System.Console.Error.WriteLine(ex); + status = 1; + } + } + + System.Environment.Exit(status); + } +} diff --git a/cs/test/Ice/inheritance/Collocated.cs b/cs/test/Ice/inheritance/Collocated.cs index 94a8ce9e5e4..0d0579a81dd 100755 --- a/cs/test/Ice/inheritance/Collocated.cs +++ b/cs/test/Ice/inheritance/Collocated.cs @@ -7,50 +7,50 @@ // // ********************************************************************** -
-public class Collocated
-{
- private static int
- run(string[] args, Ice.Communicator communicator)
- {
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object obj = new InitialI(adapter);
- adapter.add(obj, Ice.Util.stringToIdentity("initial"));
- AllTests.allTests(communicator);
- return 0;
- }
-
- public static void
- Main(string[] args)
- {
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
- }
-
- System.Environment.Exit(status);
- }
-}
+ +public class Collocated +{ + private static int + run(string[] args, Ice.Communicator communicator) + { + communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Object obj = new InitialI(adapter); + adapter.add(obj, Ice.Util.stringToIdentity("initial")); + AllTests.allTests(communicator); + return 0; + } + + public static void + Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + status = run(args, communicator); + } + catch(System.Exception ex) + { + System.Console.WriteLine(ex); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + System.Console.WriteLine(ex); + status = 1; + } + } + + System.Environment.Exit(status); + } +} diff --git a/cs/test/Ice/inheritance/IAI.cs b/cs/test/Ice/inheritance/IAI.cs index 0652bf24577..fa24d940d4c 100755 --- a/cs/test/Ice/inheritance/IAI.cs +++ b/cs/test/Ice/inheritance/IAI.cs @@ -7,15 +7,15 @@ // // ********************************************************************** -
-public sealed class IAI : MA._IADisp
-{
- public IAI()
- {
- }
-
- public override MA.IAPrx iaop(MA.IAPrx p, Ice.Current current)
- {
- return p;
- }
-}
+ +public sealed class IAI : MA._IADisp +{ + public IAI() + { + } + + public override MA.IAPrx iaop(MA.IAPrx p, Ice.Current current) + { + return p; + } +} diff --git a/cs/test/Ice/inheritance/IB1I.cs b/cs/test/Ice/inheritance/IB1I.cs index 38adf09aaa0..defc3d8456d 100755 --- a/cs/test/Ice/inheritance/IB1I.cs +++ b/cs/test/Ice/inheritance/IB1I.cs @@ -7,20 +7,20 @@ // // ********************************************************************** -
-public sealed class IB1I : MB._IB1Disp
-{
- public IB1I()
- {
- }
-
- public override MA.IAPrx iaop(MA.IAPrx p, Ice.Current current)
- {
- return p;
- }
-
- public override MB.IB1Prx ib1op(MB.IB1Prx p, Ice.Current current)
- {
- return p;
- }
-}
+ +public sealed class IB1I : MB._IB1Disp +{ + public IB1I() + { + } + + public override MA.IAPrx iaop(MA.IAPrx p, Ice.Current current) + { + return p; + } + + public override MB.IB1Prx ib1op(MB.IB1Prx p, Ice.Current current) + { + return p; + } +} diff --git a/cs/test/Ice/inheritance/IB2I.cs b/cs/test/Ice/inheritance/IB2I.cs index ac1eb745298..dcfc2f11d3f 100755 --- a/cs/test/Ice/inheritance/IB2I.cs +++ b/cs/test/Ice/inheritance/IB2I.cs @@ -7,20 +7,20 @@ // // ********************************************************************** -
-public sealed class IB2I : MB._IB2Disp
-{
- public IB2I()
- {
- }
-
- public override MA.IAPrx iaop(MA.IAPrx p, Ice.Current current)
- {
- return p;
- }
-
- public override MB.IB2Prx ib2op(MB.IB2Prx p, Ice.Current current)
- {
- return p;
- }
-}
+ +public sealed class IB2I : MB._IB2Disp +{ + public IB2I() + { + } + + public override MA.IAPrx iaop(MA.IAPrx p, Ice.Current current) + { + return p; + } + + public override MB.IB2Prx ib2op(MB.IB2Prx p, Ice.Current current) + { + return p; + } +} diff --git a/cs/test/Ice/inheritance/ICI.cs b/cs/test/Ice/inheritance/ICI.cs index 1fa54a07b4b..d8780d77f24 100755 --- a/cs/test/Ice/inheritance/ICI.cs +++ b/cs/test/Ice/inheritance/ICI.cs @@ -7,30 +7,30 @@ // // ********************************************************************** -
-public sealed class ICI : MA._ICDisp
-{
- public ICI()
- {
- }
-
- public override MA.IAPrx iaop(MA.IAPrx p, Ice.Current current)
- {
- return p;
- }
-
- public override MA.ICPrx icop(MA.ICPrx p, Ice.Current current)
- {
- return p;
- }
-
- public override MB.IB1Prx ib1op(MB.IB1Prx p, Ice.Current current)
- {
- return p;
- }
-
- public override MB.IB2Prx ib2op(MB.IB2Prx p, Ice.Current current)
- {
- return p;
- }
-}
+ +public sealed class ICI : MA._ICDisp +{ + public ICI() + { + } + + public override MA.IAPrx iaop(MA.IAPrx p, Ice.Current current) + { + return p; + } + + public override MA.ICPrx icop(MA.ICPrx p, Ice.Current current) + { + return p; + } + + public override MB.IB1Prx ib1op(MB.IB1Prx p, Ice.Current current) + { + return p; + } + + public override MB.IB2Prx ib2op(MB.IB2Prx p, Ice.Current current) + { + return p; + } +} diff --git a/cs/test/Ice/inheritance/InitialI.cs b/cs/test/Ice/inheritance/InitialI.cs index 868e5afe273..a38d5f1b828 100755 --- a/cs/test/Ice/inheritance/InitialI.cs +++ b/cs/test/Ice/inheritance/InitialI.cs @@ -7,74 +7,74 @@ // // ********************************************************************** -
-public sealed class InitialI : _InitialDisp
-{
- public InitialI(Ice.ObjectAdapter adapter)
- {
- _adapter = adapter;
- _ca = MA.CAPrxHelper.uncheckedCast(_adapter.addWithUUID(new CAI()));
- _cb = MB.CBPrxHelper.uncheckedCast(_adapter.addWithUUID(new CBI()));
- _cc = MA.CCPrxHelper.uncheckedCast(_adapter.addWithUUID(new CCI()));
- _cd = MA.CDPrxHelper.uncheckedCast(_adapter.addWithUUID(new CDI()));
- _ia = MA.IAPrxHelper.uncheckedCast(_adapter.addWithUUID(new IAI()));
- _ib1 = MB.IB1PrxHelper.uncheckedCast(_adapter.addWithUUID(new IB1I()));
- _ib2 = MB.IB2PrxHelper.uncheckedCast(_adapter.addWithUUID(new IB2I()));
- _ic = MA.ICPrxHelper.uncheckedCast(_adapter.addWithUUID(new ICI()));
- }
-
- public override MA.CAPrx caop(Ice.Current current)
- {
- return _ca;
- }
-
- public override MB.CBPrx cbop(Ice.Current current)
- {
- return _cb;
- }
-
- public override MA.CCPrx ccop(Ice.Current current)
- {
- return _cc;
- }
-
- public override MA.CDPrx cdop(Ice.Current current)
- {
- return _cd;
- }
-
- public override MA.IAPrx iaop(Ice.Current current)
- {
- return _ia;
- }
-
- public override MB.IB1Prx ib1op(Ice.Current current)
- {
- return _ib1;
- }
-
- public override MB.IB2Prx ib2op(Ice.Current current)
- {
- return _ib2;
- }
-
- public override MA.ICPrx icop(Ice.Current current)
- {
- return _ic;
- }
-
- public override void shutdown(Ice.Current current)
- {
- _adapter.getCommunicator().shutdown();
- }
-
- private Ice.ObjectAdapter _adapter;
- private MA.CAPrx _ca;
- private MB.CBPrx _cb;
- private MA.CCPrx _cc;
- private MA.CDPrx _cd;
- private MA.IAPrx _ia;
- private MB.IB1Prx _ib1;
- private MB.IB2Prx _ib2;
- private MA.ICPrx _ic;
-}
+ +public sealed class InitialI : _InitialDisp +{ + public InitialI(Ice.ObjectAdapter adapter) + { + _adapter = adapter; + _ca = MA.CAPrxHelper.uncheckedCast(_adapter.addWithUUID(new CAI())); + _cb = MB.CBPrxHelper.uncheckedCast(_adapter.addWithUUID(new CBI())); + _cc = MA.CCPrxHelper.uncheckedCast(_adapter.addWithUUID(new CCI())); + _cd = MA.CDPrxHelper.uncheckedCast(_adapter.addWithUUID(new CDI())); + _ia = MA.IAPrxHelper.uncheckedCast(_adapter.addWithUUID(new IAI())); + _ib1 = MB.IB1PrxHelper.uncheckedCast(_adapter.addWithUUID(new IB1I())); + _ib2 = MB.IB2PrxHelper.uncheckedCast(_adapter.addWithUUID(new IB2I())); + _ic = MA.ICPrxHelper.uncheckedCast(_adapter.addWithUUID(new ICI())); + } + + public override MA.CAPrx caop(Ice.Current current) + { + return _ca; + } + + public override MB.CBPrx cbop(Ice.Current current) + { + return _cb; + } + + public override MA.CCPrx ccop(Ice.Current current) + { + return _cc; + } + + public override MA.CDPrx cdop(Ice.Current current) + { + return _cd; + } + + public override MA.IAPrx iaop(Ice.Current current) + { + return _ia; + } + + public override MB.IB1Prx ib1op(Ice.Current current) + { + return _ib1; + } + + public override MB.IB2Prx ib2op(Ice.Current current) + { + return _ib2; + } + + public override MA.ICPrx icop(Ice.Current current) + { + return _ic; + } + + public override void shutdown(Ice.Current current) + { + _adapter.getCommunicator().shutdown(); + } + + private Ice.ObjectAdapter _adapter; + private MA.CAPrx _ca; + private MB.CBPrx _cb; + private MA.CCPrx _cc; + private MA.CDPrx _cd; + private MA.IAPrx _ia; + private MB.IB1Prx _ib1; + private MB.IB2Prx _ib2; + private MA.ICPrx _ic; +} diff --git a/cs/test/Ice/location/HelloI.cs b/cs/test/Ice/location/HelloI.cs index f78145204b4..c454104e0ab 100755 --- a/cs/test/Ice/location/HelloI.cs +++ b/cs/test/Ice/location/HelloI.cs @@ -7,10 +7,10 @@ // // ********************************************************************** -
-public class HelloI : _HelloDisp
-{
- public override void sayHello(Ice.Current current)
- {
- }
-}
+ +public class HelloI : _HelloDisp +{ + public override void sayHello(Ice.Current current) + { + } +} diff --git a/cs/test/Ice/location/ServerManagerI.cs b/cs/test/Ice/location/ServerManagerI.cs index d4aeea1f623..29470d1d9cc 100755 --- a/cs/test/Ice/location/ServerManagerI.cs +++ b/cs/test/Ice/location/ServerManagerI.cs @@ -49,6 +49,7 @@ public class ServerManagerI : _ServerManagerDisp { c.destroy(); } + _communicators.Clear(); _adapter.getCommunicator().shutdown(); } diff --git a/cs/test/Ice/operations/MyDerivedClassAMDI.cs b/cs/test/Ice/operations/MyDerivedClassAMDI.cs index f458ba6c272..a5fd7c2d568 100755 --- a/cs/test/Ice/operations/MyDerivedClassAMDI.cs +++ b/cs/test/Ice/operations/MyDerivedClassAMDI.cs @@ -1,345 +1,345 @@ -// **********************************************************************
-//
-// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-using System;
-using System.Threading;
-
-public sealed class MyDerivedClassI : Test.MyDerivedClass
-{
- internal class Thread_opVoid
- {
- public Thread_opVoid(Test.AMD_MyClass_opVoid cb)
- {
- _cb = cb;
- }
-
- public void Start()
- {
- _thread = new Thread(new ThreadStart(Run));
- _thread.Start();
- }
-
- public void Run()
- {
- _cb.ice_response();
- }
-
- public void Join()
- {
- _thread.Join();
- }
-
- private Test.AMD_MyClass_opVoid _cb;
- private Thread _thread;
- }
-
- public MyDerivedClassI(Ice.ObjectAdapter adapter, Ice.Identity identity)
- {
- _adapter = adapter;
- _identity = identity;
- }
-
- public override void shutdown_async(Test.AMD_MyClass_shutdown cb, Ice.Current current)
- {
- while(_opVoidThread != null)
- {
- _opVoidThread.Join();
- _opVoidThread = null;
- }
-
- _adapter.getCommunicator().shutdown();
- cb.ice_response();
- }
-
- public override void opVoid_async(Test.AMD_MyClass_opVoid cb, Ice.Current current)
- {
- while(_opVoidThread != null)
- {
- _opVoidThread.Join();
- _opVoidThread = null;
- }
-
- _opVoidThread = new Thread_opVoid(cb);
- _opVoidThread.Start();
- }
-
- public override void opBool_async(Test.AMD_MyClass_opBool cb, bool p1, bool p2, Ice.Current current)
- {
- cb.ice_response(p2, p1);
- }
-
- public override void opBoolS_async(Test.AMD_MyClass_opBoolS cb, Test.BoolS p1, Test.BoolS p2, Ice.Current current)
- {
- Test.BoolS p3 = new Test.BoolS();
- p3.AddRange(p1);
- p3.AddRange(p2);
-
- Test.BoolS r = new Test.BoolS();
- for(int i = 0; i < p1.Count; i++)
- {
- r.Add(p1[p1.Count - (i + 1)]);
- }
- cb.ice_response(r, p3);
- }
-
- public override void opBoolSS_async(Test.AMD_MyClass_opBoolSS cb, Test.BoolSS p1, Test.BoolSS p2, Ice.Current current)
- {
- Test.BoolSS p3 = new Test.BoolSS();
- p3.AddRange(p1);
- p3.AddRange(p2);
-
- Test.BoolSS r = new Test.BoolSS();
- for(int i = 0; i < p1.Count; i++)
- {
- r.Add(p1[p1.Count - (i + 1)]);
- }
- cb.ice_response(r, p3);
- }
-
- public override void opByte_async(Test.AMD_MyClass_opByte cb, byte p1, byte p2, Ice.Current current)
- {
- cb.ice_response(p1, (byte)(p1 ^ p2));
- }
-
- public override void opByteBoolD_async(Test.AMD_MyClass_opByteBoolD cb, Test.ByteBoolD p1, Test.ByteBoolD p2,
- Ice.Current current)
- {
- Test.ByteBoolD p3 = p1;
- Test.ByteBoolD r = new Test.ByteBoolD();
- r.AddRange(p1);
- r.AddRange(p2);
- cb.ice_response(r, p3);
- }
-
- public override void opByteS_async(Test.AMD_MyClass_opByteS cb, Test.ByteS p1, Test.ByteS p2, Ice.Current current)
- {
- Test.ByteS p3 = new Test.ByteS();
- for(int i = 0; i < p1.Count; i++)
- {
- p3.Add(p1[p1.Count - (i + 1)]);
- }
-
- Test.ByteS r = new Test.ByteS();
- r.AddRange(p1);
- r.AddRange(p2);
- cb.ice_response(r, p3);
- }
-
- public override void opByteSS_async(Test.AMD_MyClass_opByteSS cb, Test.ByteSS p1, Test.ByteSS p2, Ice.Current current)
- {
- Test.ByteSS p3 = new Test.ByteSS();
- for(int i = 0; i < p1.Count; i++)
- {
- p3.Add(p1[p1.Count - (i + 1)]);
- }
-
- Test.ByteSS r = new Test.ByteSS();
- r.AddRange(p1);
- r.AddRange(p2);
- cb.ice_response(r, p3);
- }
-
- public override void opFloatDouble_async(Test.AMD_MyClass_opFloatDouble cb, float p1, double p2, Ice.Current current)
- {
- cb.ice_response(p2, p1, p2);
- }
-
- public override void opFloatDoubleS_async(Test.AMD_MyClass_opFloatDoubleS cb, Test.FloatS p1, Test.DoubleS p2, Ice.Current current)
- {
- Test.FloatS p3 = p1;
- Test.DoubleS p4 = new Test.DoubleS();
- for(int i = 0; i < p2.Count; i++)
- {
- p4.Add(p2[p2.Count - (i + 1)]);
- }
- Test.DoubleS r = new Test.DoubleS();
- r.AddRange(p2);
- for(int i = 0; i < p1.Count; i++)
- {
- r.Add(p1[i]);
- }
- cb.ice_response(r, p3, p4);
- }
-
- public override void opFloatDoubleSS_async(Test.AMD_MyClass_opFloatDoubleSS cb, Test.FloatSS p1, Test.DoubleSS p2, Ice.Current current)
- {
- Test.FloatSS p3 = p1;
- Test.DoubleSS p4 = new Test.DoubleSS();
- for(int i = 0; i < p2.Count; i++)
- {
- p4.Add(p2[p2.Count - (i + 1)]);
- }
- Test.DoubleSS r = new Test.DoubleSS();
- r.AddRange(p2);
- r.AddRange(p2);
- cb.ice_response(r, p3, p4);
- }
-
- public override void opLongFloatD_async(Test.AMD_MyClass_opLongFloatD cb, Test.LongFloatD p1, Test.LongFloatD p2,
- Ice.Current current)
- {
- Test.LongFloatD p3 = p1;
- Test.LongFloatD r = new Test.LongFloatD();
- r.AddRange(p1);
- r.AddRange(p2);
- cb.ice_response(r, p3);
- }
-
- public override void opMyClass_async(Test.AMD_MyClass_opMyClass cb, Test.MyClassPrx p1, Ice.Current current)
- {
- Test.MyClassPrx p2 = p1;
- Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast(_adapter.createProxy(Ice.Util.stringToIdentity("noSuchIdentity")));
- cb.ice_response(Test.MyClassPrxHelper.uncheckedCast(_adapter.createProxy(_identity)), p2, p3);
- }
-
- public override void opMyEnum_async(Test.AMD_MyClass_opMyEnum cb, Test.MyEnum p1, Ice.Current current)
- {
- cb.ice_response(Test.MyEnum.enum3, p1);
- }
-
- public override void opShortIntD_async(Test.AMD_MyClass_opShortIntD cb, Test.ShortIntD p1, Test.ShortIntD p2,
- Ice.Current current)
- {
- Test.ShortIntD p3 = p1;
- Test.ShortIntD r = new Test.ShortIntD();
- r.AddRange(p1);
- r.AddRange(p2);
- cb.ice_response(r, p3);
- }
-
- public override void opShortIntLong_async(Test.AMD_MyClass_opShortIntLong cb, short p1, int p2, long p3, Ice.Current current)
- {
- cb.ice_response(p3, p1, p2, p3);
- }
-
- public override void opShortIntLongS_async(Test.AMD_MyClass_opShortIntLongS cb, Test.ShortS p1, Test.IntS p2, Test.LongS p3, Ice.Current current)
- {
- Test.ShortS p4 = p1;
- Test.IntS p5 = new Test.IntS();
- for(int i = 0; i < p2.Count; i++)
- {
- p5.Add(p2[p2.Count - (i + 1)]);
- }
- Test.LongS p6 = new Test.LongS();
- p6.AddRange(p3);
- p6.AddRange(p3);
- cb.ice_response(p3, p4, p5, p6);
- }
-
- public override void opShortIntLongSS_async(Test.AMD_MyClass_opShortIntLongSS cb, Test.ShortSS p1, Test.IntSS p2, Test.LongSS p3, Ice.Current current)
- {
- Test.ShortSS p4 = p1;
- Test.IntSS p5 = new Test.IntSS();
- for(int i = 0; i < p2.Count; i++)
- {
- p5.Add(p2[p2.Count - (i + 1)]);
- }
- Test.LongSS p6 = new Test.LongSS();
- p6.AddRange(p3);
- p6.AddRange(p3);
- cb.ice_response(p3, p4, p5, p6);
- }
-
- public override void opString_async(Test.AMD_MyClass_opString cb, string p1, string p2, Ice.Current current)
- {
- cb.ice_response(p1 + " " + p2, p2 + " " + p1);
- }
-
- public override void opStringMyEnumD_async(Test.AMD_MyClass_opStringMyEnumD cb, Test.StringMyEnumD p1, Test.StringMyEnumD p2,
- Ice.Current current)
- {
- Test.StringMyEnumD p3 = p1;
- Test.StringMyEnumD r = new Test.StringMyEnumD();
- r.AddRange(p1);
- r.AddRange(p2);
- cb.ice_response(r, p3);
- }
-
- public override void opIntS_async(Test.AMD_MyClass_opIntS cb, Test.IntS s, Ice.Current current)
- {
- Test.IntS r = new Test.IntS();
- for(int i = 0; i < s.Count; ++i)
- {
- r.Add(-s[i]);
- }
- cb.ice_response(r);
- }
-
- public override void opContext_async(Test.AMD_MyClass_opContext cb, Ice.Current current)
- {
- cb.ice_response(current.ctx);
- }
-
- public override void opStringS_async(Test.AMD_MyClass_opStringS cb, Test.StringS p1, Test.StringS p2, Ice.Current current)
- {
- Test.StringS p3 = new Test.StringS();
- p3.AddRange(p1);
- p3.AddRange(p2);
-
- Test.StringS r = new Test.StringS();
- for(int i = 0; i < p1.Count; i++)
- {
- r.Add(p1[p1.Count - (i + 1)]);
- }
- cb.ice_response(r, p3);
- }
-
- public override void opStringSS_async(Test.AMD_MyClass_opStringSS cb, Test.StringSS p1, Test.StringSS p2, Ice.Current current)
- {
- Test.StringSS p3 = new Test.StringSS();
- p3.AddRange(p1);
- p3.AddRange(p2);
-
- Test.StringSS r = new Test.StringSS();
- for(int i = 0; i < p2.Count; i++)
- {
- r.Add(p2[p2.Count - (i + 1)]);
- }
- cb.ice_response(r, p3);
- }
-
- public override void opStringSSS_async(Test.AMD_MyClass_opStringSSS cb, Test.StringSS[] p1, Test.StringSS[] p2, Ice.Current current)
- {
- Test.StringSS[] p3 = new Test.StringSS[p1.Length + p2.Length];
- Array.Copy(p1, 0, p3, 0, p1.Length);
- Array.Copy(p2, 0, p3, p1.Length, p2.Length);
-
- Test.StringSS[] r = new Test.StringSS[p2.Length];
- for(int i = 0; i < p2.Length; i++)
- {
- r[i] = p2[p2.Length - (i + 1)];
- }
- cb.ice_response(r, p3);
- }
-
- public override void opStringStringD_async(Test.AMD_MyClass_opStringStringD cb, Test.StringStringD p1, Test.StringStringD p2, Ice.Current current)
- {
- Test.StringStringD p3 = p1;
- Test.StringStringD r = new Test.StringStringD();
- r.AddRange(p1);
- r.AddRange(p2);
- cb.ice_response(r, p3);
- }
-
- public override void opStruct_async(Test.AMD_MyClass_opStruct cb, Test.Structure p1, Test.Structure p2, Ice.Current current)
- {
- Test.Structure p3 = p1;
- p3.s.s = "a new string";
- cb.ice_response(p2, p3);
- }
-
- public override void opDerived_async(Test.AMD_MyDerivedClass_opDerived cb, Ice.Current current)
- {
- cb.ice_response();
- }
-
- private Ice.ObjectAdapter _adapter;
- private Ice.Identity _identity;
- private Thread_opVoid _opVoidThread;
-}
+// ********************************************************************** +// +// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +using System; +using System.Threading; + +public sealed class MyDerivedClassI : Test.MyDerivedClass +{ + internal class Thread_opVoid + { + public Thread_opVoid(Test.AMD_MyClass_opVoid cb) + { + _cb = cb; + } + + public void Start() + { + _thread = new Thread(new ThreadStart(Run)); + _thread.Start(); + } + + public void Run() + { + _cb.ice_response(); + } + + public void Join() + { + _thread.Join(); + } + + private Test.AMD_MyClass_opVoid _cb; + private Thread _thread; + } + + public MyDerivedClassI(Ice.ObjectAdapter adapter, Ice.Identity identity) + { + _adapter = adapter; + _identity = identity; + } + + public override void shutdown_async(Test.AMD_MyClass_shutdown cb, Ice.Current current) + { + while(_opVoidThread != null) + { + _opVoidThread.Join(); + _opVoidThread = null; + } + + _adapter.getCommunicator().shutdown(); + cb.ice_response(); + } + + public override void opVoid_async(Test.AMD_MyClass_opVoid cb, Ice.Current current) + { + while(_opVoidThread != null) + { + _opVoidThread.Join(); + _opVoidThread = null; + } + + _opVoidThread = new Thread_opVoid(cb); + _opVoidThread.Start(); + } + + public override void opBool_async(Test.AMD_MyClass_opBool cb, bool p1, bool p2, Ice.Current current) + { + cb.ice_response(p2, p1); + } + + public override void opBoolS_async(Test.AMD_MyClass_opBoolS cb, Test.BoolS p1, Test.BoolS p2, Ice.Current current) + { + Test.BoolS p3 = new Test.BoolS(); + p3.AddRange(p1); + p3.AddRange(p2); + + Test.BoolS r = new Test.BoolS(); + for(int i = 0; i < p1.Count; i++) + { + r.Add(p1[p1.Count - (i + 1)]); + } + cb.ice_response(r, p3); + } + + public override void opBoolSS_async(Test.AMD_MyClass_opBoolSS cb, Test.BoolSS p1, Test.BoolSS p2, Ice.Current current) + { + Test.BoolSS p3 = new Test.BoolSS(); + p3.AddRange(p1); + p3.AddRange(p2); + + Test.BoolSS r = new Test.BoolSS(); + for(int i = 0; i < p1.Count; i++) + { + r.Add(p1[p1.Count - (i + 1)]); + } + cb.ice_response(r, p3); + } + + public override void opByte_async(Test.AMD_MyClass_opByte cb, byte p1, byte p2, Ice.Current current) + { + cb.ice_response(p1, (byte)(p1 ^ p2)); + } + + public override void opByteBoolD_async(Test.AMD_MyClass_opByteBoolD cb, Test.ByteBoolD p1, Test.ByteBoolD p2, + Ice.Current current) + { + Test.ByteBoolD p3 = p1; + Test.ByteBoolD r = new Test.ByteBoolD(); + r.AddRange(p1); + r.AddRange(p2); + cb.ice_response(r, p3); + } + + public override void opByteS_async(Test.AMD_MyClass_opByteS cb, Test.ByteS p1, Test.ByteS p2, Ice.Current current) + { + Test.ByteS p3 = new Test.ByteS(); + for(int i = 0; i < p1.Count; i++) + { + p3.Add(p1[p1.Count - (i + 1)]); + } + + Test.ByteS r = new Test.ByteS(); + r.AddRange(p1); + r.AddRange(p2); + cb.ice_response(r, p3); + } + + public override void opByteSS_async(Test.AMD_MyClass_opByteSS cb, Test.ByteSS p1, Test.ByteSS p2, Ice.Current current) + { + Test.ByteSS p3 = new Test.ByteSS(); + for(int i = 0; i < p1.Count; i++) + { + p3.Add(p1[p1.Count - (i + 1)]); + } + + Test.ByteSS r = new Test.ByteSS(); + r.AddRange(p1); + r.AddRange(p2); + cb.ice_response(r, p3); + } + + public override void opFloatDouble_async(Test.AMD_MyClass_opFloatDouble cb, float p1, double p2, Ice.Current current) + { + cb.ice_response(p2, p1, p2); + } + + public override void opFloatDoubleS_async(Test.AMD_MyClass_opFloatDoubleS cb, Test.FloatS p1, Test.DoubleS p2, Ice.Current current) + { + Test.FloatS p3 = p1; + Test.DoubleS p4 = new Test.DoubleS(); + for(int i = 0; i < p2.Count; i++) + { + p4.Add(p2[p2.Count - (i + 1)]); + } + Test.DoubleS r = new Test.DoubleS(); + r.AddRange(p2); + for(int i = 0; i < p1.Count; i++) + { + r.Add(p1[i]); + } + cb.ice_response(r, p3, p4); + } + + public override void opFloatDoubleSS_async(Test.AMD_MyClass_opFloatDoubleSS cb, Test.FloatSS p1, Test.DoubleSS p2, Ice.Current current) + { + Test.FloatSS p3 = p1; + Test.DoubleSS p4 = new Test.DoubleSS(); + for(int i = 0; i < p2.Count; i++) + { + p4.Add(p2[p2.Count - (i + 1)]); + } + Test.DoubleSS r = new Test.DoubleSS(); + r.AddRange(p2); + r.AddRange(p2); + cb.ice_response(r, p3, p4); + } + + public override void opLongFloatD_async(Test.AMD_MyClass_opLongFloatD cb, Test.LongFloatD p1, Test.LongFloatD p2, + Ice.Current current) + { + Test.LongFloatD p3 = p1; + Test.LongFloatD r = new Test.LongFloatD(); + r.AddRange(p1); + r.AddRange(p2); + cb.ice_response(r, p3); + } + + public override void opMyClass_async(Test.AMD_MyClass_opMyClass cb, Test.MyClassPrx p1, Ice.Current current) + { + Test.MyClassPrx p2 = p1; + Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast(_adapter.createProxy(Ice.Util.stringToIdentity("noSuchIdentity"))); + cb.ice_response(Test.MyClassPrxHelper.uncheckedCast(_adapter.createProxy(_identity)), p2, p3); + } + + public override void opMyEnum_async(Test.AMD_MyClass_opMyEnum cb, Test.MyEnum p1, Ice.Current current) + { + cb.ice_response(Test.MyEnum.enum3, p1); + } + + public override void opShortIntD_async(Test.AMD_MyClass_opShortIntD cb, Test.ShortIntD p1, Test.ShortIntD p2, + Ice.Current current) + { + Test.ShortIntD p3 = p1; + Test.ShortIntD r = new Test.ShortIntD(); + r.AddRange(p1); + r.AddRange(p2); + cb.ice_response(r, p3); + } + + public override void opShortIntLong_async(Test.AMD_MyClass_opShortIntLong cb, short p1, int p2, long p3, Ice.Current current) + { + cb.ice_response(p3, p1, p2, p3); + } + + public override void opShortIntLongS_async(Test.AMD_MyClass_opShortIntLongS cb, Test.ShortS p1, Test.IntS p2, Test.LongS p3, Ice.Current current) + { + Test.ShortS p4 = p1; + Test.IntS p5 = new Test.IntS(); + for(int i = 0; i < p2.Count; i++) + { + p5.Add(p2[p2.Count - (i + 1)]); + } + Test.LongS p6 = new Test.LongS(); + p6.AddRange(p3); + p6.AddRange(p3); + cb.ice_response(p3, p4, p5, p6); + } + + public override void opShortIntLongSS_async(Test.AMD_MyClass_opShortIntLongSS cb, Test.ShortSS p1, Test.IntSS p2, Test.LongSS p3, Ice.Current current) + { + Test.ShortSS p4 = p1; + Test.IntSS p5 = new Test.IntSS(); + for(int i = 0; i < p2.Count; i++) + { + p5.Add(p2[p2.Count - (i + 1)]); + } + Test.LongSS p6 = new Test.LongSS(); + p6.AddRange(p3); + p6.AddRange(p3); + cb.ice_response(p3, p4, p5, p6); + } + + public override void opString_async(Test.AMD_MyClass_opString cb, string p1, string p2, Ice.Current current) + { + cb.ice_response(p1 + " " + p2, p2 + " " + p1); + } + + public override void opStringMyEnumD_async(Test.AMD_MyClass_opStringMyEnumD cb, Test.StringMyEnumD p1, Test.StringMyEnumD p2, + Ice.Current current) + { + Test.StringMyEnumD p3 = p1; + Test.StringMyEnumD r = new Test.StringMyEnumD(); + r.AddRange(p1); + r.AddRange(p2); + cb.ice_response(r, p3); + } + + public override void opIntS_async(Test.AMD_MyClass_opIntS cb, Test.IntS s, Ice.Current current) + { + Test.IntS r = new Test.IntS(); + for(int i = 0; i < s.Count; ++i) + { + r.Add(-s[i]); + } + cb.ice_response(r); + } + + public override void opContext_async(Test.AMD_MyClass_opContext cb, Ice.Current current) + { + cb.ice_response(current.ctx); + } + + public override void opStringS_async(Test.AMD_MyClass_opStringS cb, Test.StringS p1, Test.StringS p2, Ice.Current current) + { + Test.StringS p3 = new Test.StringS(); + p3.AddRange(p1); + p3.AddRange(p2); + + Test.StringS r = new Test.StringS(); + for(int i = 0; i < p1.Count; i++) + { + r.Add(p1[p1.Count - (i + 1)]); + } + cb.ice_response(r, p3); + } + + public override void opStringSS_async(Test.AMD_MyClass_opStringSS cb, Test.StringSS p1, Test.StringSS p2, Ice.Current current) + { + Test.StringSS p3 = new Test.StringSS(); + p3.AddRange(p1); + p3.AddRange(p2); + + Test.StringSS r = new Test.StringSS(); + for(int i = 0; i < p2.Count; i++) + { + r.Add(p2[p2.Count - (i + 1)]); + } + cb.ice_response(r, p3); + } + + public override void opStringSSS_async(Test.AMD_MyClass_opStringSSS cb, Test.StringSS[] p1, Test.StringSS[] p2, Ice.Current current) + { + Test.StringSS[] p3 = new Test.StringSS[p1.Length + p2.Length]; + Array.Copy(p1, 0, p3, 0, p1.Length); + Array.Copy(p2, 0, p3, p1.Length, p2.Length); + + Test.StringSS[] r = new Test.StringSS[p2.Length]; + for(int i = 0; i < p2.Length; i++) + { + r[i] = p2[p2.Length - (i + 1)]; + } + cb.ice_response(r, p3); + } + + public override void opStringStringD_async(Test.AMD_MyClass_opStringStringD cb, Test.StringStringD p1, Test.StringStringD p2, Ice.Current current) + { + Test.StringStringD p3 = p1; + Test.StringStringD r = new Test.StringStringD(); + r.AddRange(p1); + r.AddRange(p2); + cb.ice_response(r, p3); + } + + public override void opStruct_async(Test.AMD_MyClass_opStruct cb, Test.Structure p1, Test.Structure p2, Ice.Current current) + { + Test.Structure p3 = p1; + p3.s.s = "a new string"; + cb.ice_response(p2, p3); + } + + public override void opDerived_async(Test.AMD_MyDerivedClass_opDerived cb, Ice.Current current) + { + cb.ice_response(); + } + + private Ice.ObjectAdapter _adapter; + private Ice.Identity _identity; + private Thread_opVoid _opVoidThread; +} diff --git a/cs/test/Ice/slicing/exceptions/TestAMDI.cs b/cs/test/Ice/slicing/exceptions/TestAMDI.cs index f153c769443..0e3509e237c 100755 --- a/cs/test/Ice/slicing/exceptions/TestAMDI.cs +++ b/cs/test/Ice/slicing/exceptions/TestAMDI.cs @@ -1,134 +1,134 @@ -using System;
-// **********************************************************************
-//
-// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-
-public sealed class TestI : _TestDisp
-{
- public TestI(Ice.ObjectAdapter adapter)
- {
- _adapter = adapter;
- }
-
- public override void shutdown_async(AMD_Test_shutdown cb, Ice.Current current)
- {
- _adapter.getCommunicator().shutdown();
- cb.ice_response();
- }
-
- public override void baseAsBase_async(AMD_Test_baseAsBase cb, Ice.Current current)
- {
- Base b = new Base();
- b.b = "Base.b";
- cb.ice_exception(b);
- }
-
- public override void unknownDerivedAsBase_async(AMD_Test_unknownDerivedAsBase cb, Ice.Current current)
- {
- UnknownDerived d = new UnknownDerived();
- d.b = "UnknownDerived.b";
- d.ud = "UnknownDerived.ud";
- cb.ice_exception(d);
- }
-
- public override void knownDerivedAsBase_async(AMD_Test_knownDerivedAsBase cb, Ice.Current current)
- {
- KnownDerived d = new KnownDerived();
- d.b = "KnownDerived.b";
- d.kd = "KnownDerived.kd";
- cb.ice_exception(d);
- }
-
- public override void knownDerivedAsKnownDerived_async(AMD_Test_knownDerivedAsKnownDerived cb, Ice.Current current)
- {
- KnownDerived d = new KnownDerived();
- d.b = "KnownDerived.b";
- d.kd = "KnownDerived.kd";
- cb.ice_exception(d);
- }
-
- public override void unknownIntermediateAsBase_async(AMD_Test_unknownIntermediateAsBase cb, Ice.Current current)
- {
- UnknownIntermediate ui = new UnknownIntermediate();
- ui.b = "UnknownIntermediate.b";
- ui.ui = "UnknownIntermediate.ui";
- cb.ice_exception(ui);
- }
-
- public override void knownIntermediateAsBase_async(AMD_Test_knownIntermediateAsBase cb, Ice.Current current)
- {
- KnownIntermediate ki = new KnownIntermediate();
- ki.b = "KnownIntermediate.b";
- ki.ki = "KnownIntermediate.ki";
- cb.ice_exception(ki);
- }
-
- public override void knownMostDerivedAsBase_async(AMD_Test_knownMostDerivedAsBase cb, Ice.Current current)
- {
- KnownMostDerived kmd = new KnownMostDerived();
- kmd.b = "KnownMostDerived.b";
- kmd.ki = "KnownMostDerived.ki";
- kmd.kmd = "KnownMostDerived.kmd";
- cb.ice_exception(kmd);
- }
-
- public override void knownIntermediateAsKnownIntermediate_async(AMD_Test_knownIntermediateAsKnownIntermediate cb, Ice.Current current)
- {
- KnownIntermediate ki = new KnownIntermediate();
- ki.b = "KnownIntermediate.b";
- ki.ki = "KnownIntermediate.ki";
- cb.ice_exception(ki);
- }
-
- public override void knownMostDerivedAsKnownIntermediate_async(AMD_Test_knownMostDerivedAsKnownIntermediate cb, Ice.Current current)
- {
- KnownMostDerived kmd = new KnownMostDerived();
- kmd.b = "KnownMostDerived.b";
- kmd.ki = "KnownMostDerived.ki";
- kmd.kmd = "KnownMostDerived.kmd";
- cb.ice_exception(kmd);
- }
-
- public override void knownMostDerivedAsKnownMostDerived_async(AMD_Test_knownMostDerivedAsKnownMostDerived cb, Ice.Current current)
- {
- KnownMostDerived kmd = new KnownMostDerived();
- kmd.b = "KnownMostDerived.b";
- kmd.ki = "KnownMostDerived.ki";
- kmd.kmd = "KnownMostDerived.kmd";
- cb.ice_exception(kmd);
- }
-
- public override void unknownMostDerived1AsBase_async(AMD_Test_unknownMostDerived1AsBase cb, Ice.Current current)
- {
- UnknownMostDerived1 umd1 = new UnknownMostDerived1();
- umd1.b = "UnknownMostDerived1.b";
- umd1.ki = "UnknownMostDerived1.ki";
- umd1.umd1 = "UnknownMostDerived1.umd1";
- cb.ice_exception(umd1);
- }
-
- public override void unknownMostDerived1AsKnownIntermediate_async(AMD_Test_unknownMostDerived1AsKnownIntermediate cb, Ice.Current current)
- {
- UnknownMostDerived1 umd1 = new UnknownMostDerived1();
- umd1.b = "UnknownMostDerived1.b";
- umd1.ki = "UnknownMostDerived1.ki";
- umd1.umd1 = "UnknownMostDerived1.umd1";
- cb.ice_exception(umd1);
- }
-
- public override void unknownMostDerived2AsBase_async(AMD_Test_unknownMostDerived2AsBase cb, Ice.Current current)
- {
- UnknownMostDerived2 umd2 = new UnknownMostDerived2();
- umd2.b = "UnknownMostDerived2.b";
- umd2.ui = "UnknownMostDerived2.ui";
- umd2.umd2 = "UnknownMostDerived2.umd2";
- cb.ice_exception(umd2);
- }
- private Ice.ObjectAdapter _adapter;
-}
+// ********************************************************************** +// +// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +using System; + +public sealed class TestI : _TestDisp +{ + public TestI(Ice.ObjectAdapter adapter) + { + _adapter = adapter; + } + + public override void shutdown_async(AMD_Test_shutdown cb, Ice.Current current) + { + _adapter.getCommunicator().shutdown(); + cb.ice_response(); + } + + public override void baseAsBase_async(AMD_Test_baseAsBase cb, Ice.Current current) + { + Base b = new Base(); + b.b = "Base.b"; + cb.ice_exception(b); + } + + public override void unknownDerivedAsBase_async(AMD_Test_unknownDerivedAsBase cb, Ice.Current current) + { + UnknownDerived d = new UnknownDerived(); + d.b = "UnknownDerived.b"; + d.ud = "UnknownDerived.ud"; + cb.ice_exception(d); + } + + public override void knownDerivedAsBase_async(AMD_Test_knownDerivedAsBase cb, Ice.Current current) + { + KnownDerived d = new KnownDerived(); + d.b = "KnownDerived.b"; + d.kd = "KnownDerived.kd"; + cb.ice_exception(d); + } + + public override void knownDerivedAsKnownDerived_async(AMD_Test_knownDerivedAsKnownDerived cb, Ice.Current current) + { + KnownDerived d = new KnownDerived(); + d.b = "KnownDerived.b"; + d.kd = "KnownDerived.kd"; + cb.ice_exception(d); + } + + public override void unknownIntermediateAsBase_async(AMD_Test_unknownIntermediateAsBase cb, Ice.Current current) + { + UnknownIntermediate ui = new UnknownIntermediate(); + ui.b = "UnknownIntermediate.b"; + ui.ui = "UnknownIntermediate.ui"; + cb.ice_exception(ui); + } + + public override void knownIntermediateAsBase_async(AMD_Test_knownIntermediateAsBase cb, Ice.Current current) + { + KnownIntermediate ki = new KnownIntermediate(); + ki.b = "KnownIntermediate.b"; + ki.ki = "KnownIntermediate.ki"; + cb.ice_exception(ki); + } + + public override void knownMostDerivedAsBase_async(AMD_Test_knownMostDerivedAsBase cb, Ice.Current current) + { + KnownMostDerived kmd = new KnownMostDerived(); + kmd.b = "KnownMostDerived.b"; + kmd.ki = "KnownMostDerived.ki"; + kmd.kmd = "KnownMostDerived.kmd"; + cb.ice_exception(kmd); + } + + public override void knownIntermediateAsKnownIntermediate_async(AMD_Test_knownIntermediateAsKnownIntermediate cb, Ice.Current current) + { + KnownIntermediate ki = new KnownIntermediate(); + ki.b = "KnownIntermediate.b"; + ki.ki = "KnownIntermediate.ki"; + cb.ice_exception(ki); + } + + public override void knownMostDerivedAsKnownIntermediate_async(AMD_Test_knownMostDerivedAsKnownIntermediate cb, Ice.Current current) + { + KnownMostDerived kmd = new KnownMostDerived(); + kmd.b = "KnownMostDerived.b"; + kmd.ki = "KnownMostDerived.ki"; + kmd.kmd = "KnownMostDerived.kmd"; + cb.ice_exception(kmd); + } + + public override void knownMostDerivedAsKnownMostDerived_async(AMD_Test_knownMostDerivedAsKnownMostDerived cb, Ice.Current current) + { + KnownMostDerived kmd = new KnownMostDerived(); + kmd.b = "KnownMostDerived.b"; + kmd.ki = "KnownMostDerived.ki"; + kmd.kmd = "KnownMostDerived.kmd"; + cb.ice_exception(kmd); + } + + public override void unknownMostDerived1AsBase_async(AMD_Test_unknownMostDerived1AsBase cb, Ice.Current current) + { + UnknownMostDerived1 umd1 = new UnknownMostDerived1(); + umd1.b = "UnknownMostDerived1.b"; + umd1.ki = "UnknownMostDerived1.ki"; + umd1.umd1 = "UnknownMostDerived1.umd1"; + cb.ice_exception(umd1); + } + + public override void unknownMostDerived1AsKnownIntermediate_async(AMD_Test_unknownMostDerived1AsKnownIntermediate cb, Ice.Current current) + { + UnknownMostDerived1 umd1 = new UnknownMostDerived1(); + umd1.b = "UnknownMostDerived1.b"; + umd1.ki = "UnknownMostDerived1.ki"; + umd1.umd1 = "UnknownMostDerived1.umd1"; + cb.ice_exception(umd1); + } + + public override void unknownMostDerived2AsBase_async(AMD_Test_unknownMostDerived2AsBase cb, Ice.Current current) + { + UnknownMostDerived2 umd2 = new UnknownMostDerived2(); + umd2.b = "UnknownMostDerived2.b"; + umd2.ui = "UnknownMostDerived2.ui"; + umd2.umd2 = "UnknownMostDerived2.umd2"; + cb.ice_exception(umd2); + } + private Ice.ObjectAdapter _adapter; +} diff --git a/cs/test/Ice/slicing/objects/Server.cs b/cs/test/Ice/slicing/objects/Server.cs index 2759481f6dc..91e910b32c9 100755 --- a/cs/test/Ice/slicing/objects/Server.cs +++ b/cs/test/Ice/slicing/objects/Server.cs @@ -7,51 +7,51 @@ // // ********************************************************************** -
-public class Server
-{
- private static int run(string[] args, Ice.Communicator communicator)
- {
- Ice.Properties properties = communicator.getProperties();
- properties.setProperty("Ice.Warn.Dispatch", "0");
- properties.setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object obj = new TestI(adapter);
- adapter.add(obj, Ice.Util.stringToIdentity("Test"));
- adapter.activate();
- communicator.waitForShutdown();
- return 0;
- }
-
- public static void Main(string[] args)
- {
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(Ice.LocalException ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- System.Environment.Exit(status);
- }
-}
+ +public class Server +{ + private static int run(string[] args, Ice.Communicator communicator) + { + Ice.Properties properties = communicator.getProperties(); + properties.setProperty("Ice.Warn.Dispatch", "0"); + properties.setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Object obj = new TestI(adapter); + adapter.add(obj, Ice.Util.stringToIdentity("Test")); + adapter.activate(); + communicator.waitForShutdown(); + return 0; + } + + public static void Main(string[] args) + { + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + status = run(args, communicator); + } + catch(Ice.LocalException ex) + { + System.Console.Error.WriteLine(ex); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + System.Console.Error.WriteLine(ex); + status = 1; + } + } + + System.Environment.Exit(status); + } +} diff --git a/cs/test/Ice/slicing/objects/TestAMDI.cs b/cs/test/Ice/slicing/objects/TestAMDI.cs index 9660faf8b38..47fc2c96a98 100755 --- a/cs/test/Ice/slicing/objects/TestAMDI.cs +++ b/cs/test/Ice/slicing/objects/TestAMDI.cs @@ -1,342 +1,343 @@ -using System;
-// **********************************************************************
-//
-// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-public sealed class TestI : _TestDisp
-{
- public TestI(Ice.ObjectAdapter adapter)
- {
- _adapter = adapter;
- }
-
- public override void shutdown_async(AMD_Test_shutdown cb, Ice.Current current)
- {
- _adapter.getCommunicator().shutdown();
- cb.ice_response();
- }
-
- public override void SBaseAsObject_async(AMD_Test_SBaseAsObject cb, Ice.Current current)
- {
- SBase sb = new SBase();
- sb.sb = "SBase.sb";
- cb.ice_response(sb);
- }
-
- public override void SBaseAsSBase_async(AMD_Test_SBaseAsSBase cb, Ice.Current current)
- {
- SBase sb = new SBase();
- sb.sb = "SBase.sb";
- cb.ice_response(sb);
- }
-
- public override void SBSKnownDerivedAsSBase_async(AMD_Test_SBSKnownDerivedAsSBase cb, Ice.Current current)
- {
- SBSKnownDerived sbskd = new SBSKnownDerived();
- sbskd.sb = "SBSKnownDerived.sb";
- sbskd.sbskd = "SBSKnownDerived.sbskd";
- cb.ice_response(sbskd);
- }
-
- public override void SBSKnownDerivedAsSBSKnownDerived_async(AMD_Test_SBSKnownDerivedAsSBSKnownDerived cb, Ice.Current current)
- {
- SBSKnownDerived sbskd = new SBSKnownDerived();
- sbskd.sb = "SBSKnownDerived.sb";
- sbskd.sbskd = "SBSKnownDerived.sbskd";
- cb.ice_response(sbskd);
- }
-
- public override void SBSUnknownDerivedAsSBase_async(AMD_Test_SBSUnknownDerivedAsSBase cb, Ice.Current current)
- {
- SBSUnknownDerived sbsud = new SBSUnknownDerived();
- sbsud.sb = "SBSUnknownDerived.sb";
- sbsud.sbsud = "SBSUnknownDerived.sbsud";
- cb.ice_response(sbsud);
- }
-
- public override void SUnknownAsObject_async(AMD_Test_SUnknownAsObject cb, Ice.Current current)
- {
- SUnknown su = new SUnknown();
- su.su = "SUnknown.su";
- cb.ice_response(su);
- }
-
- public override void oneElementCycle_async(AMD_Test_oneElementCycle cb, Ice.Current current)
- {
- B b = new B();
- b.sb = "B1.sb";
- b.pb = b;
- cb.ice_response(b);
- }
-
- public override void twoElementCycle_async(AMD_Test_twoElementCycle cb, Ice.Current current)
- {
- B b1 = new B();
- b1.sb = "B1.sb";
- B b2 = new B();
- b2.sb = "B2.sb";
- b2.pb = b1;
- b1.pb = b2;
- cb.ice_response(b1);
- }
-
- public override void D1AsB_async(AMD_Test_D1AsB cb, Ice.Current current)
- {
- D1 d1 = new D1();
- d1.sb = "D1.sb";
- d1.sd1 = "D1.sd1";
- D2 d2 = new D2();
- d2.pb = d1;
- d2.sb = "D2.sb";
- d2.sd2 = "D2.sd2";
- d2.pd2 = d1;
- d1.pb = d2;
- d1.pd1 = d2;
- cb.ice_response(d1);
- }
-
- public override void D1AsD1_async(AMD_Test_D1AsD1 cb, Ice.Current current)
- {
- D1 d1 = new D1();
- d1.sb = "D1.sb";
- d1.sd1 = "D1.sd1";
- D2 d2 = new D2();
- d2.pb = d1;
- d2.sb = "D2.sb";
- d2.sd2 = "D2.sd2";
- d2.pd2 = d1;
- d1.pb = d2;
- d1.pd1 = d2;
- cb.ice_response(d1);
- }
-
- public override void D2AsB_async(AMD_Test_D2AsB cb, Ice.Current current)
- {
- D2 d2 = new D2();
- d2.sb = "D2.sb";
- d2.sd2 = "D2.sd2";
- D1 d1 = new D1();
- d1.pb = d2;
- d1.sb = "D1.sb";
- d1.sd1 = "D1.sd1";
- d1.pd1 = d2;
- d2.pb = d1;
- d2.pd2 = d1;
- cb.ice_response(d2);
- }
-
- public override void paramTest1_async(AMD_Test_paramTest1 cb, Ice.Current current)
- {
- D1 d1 = new D1();
- d1.sb = "D1.sb";
- d1.sd1 = "D1.sd1";
- D2 d2 = new D2();
- d2.pb = d1;
- d2.sb = "D2.sb";
- d2.sd2 = "D2.sd2";
- d2.pd2 = d1;
- d1.pb = d2;
- d1.pd1 = d2;
- cb.ice_response(d1, d2);
- }
-
- public override void paramTest2_async(AMD_Test_paramTest2 cb, Ice.Current current)
- {
- D1 d1 = new D1();
- d1.sb = "D1.sb";
- d1.sd1 = "D1.sd1";
- D2 d2 = new D2();
- d2.pb = d1;
- d2.sb = "D2.sb";
- d2.sd2 = "D2.sd2";
- d2.pd2 = d1;
- d1.pb = d2;
- d1.pd1 = d2;
- cb.ice_response(d2, d1);
- }
-
- public override void paramTest3_async(AMD_Test_paramTest3 cb, Ice.Current current)
- {
- D2 d2 = new D2();
- d2.sb = "D2.sb (p1 1)";
- d2.pb = null;
- d2.sd2 = "D2.sd2 (p1 1)";
-
- D1 d1 = new D1();
- d1.sb = "D1.sb (p1 2)";
- d1.pb = null;
- d1.sd1 = "D1.sd2 (p1 2)";
- d1.pd1 = null;
- d2.pd2 = d1;
-
- D2 d4 = new D2();
- d4.sb = "D2.sb (p2 1)";
- d4.pb = null;
- d4.sd2 = "D2.sd2 (p2 1)";
-
- D1 d3 = new D1();
- d3.sb = "D1.sb (p2 2)";
- d3.pb = null;
- d3.sd1 = "D1.sd2 (p2 2)";
- d3.pd1 = null;
- d4.pd2 = d3;
- cb.ice_response(d3, d2, d4);
- }
-
- public override void paramTest4_async(AMD_Test_paramTest4 cb, Ice.Current current)
- {
- D4 d4 = new D4();
- d4.sb = "D4.sb (1)";
- d4.pb = null;
- d4.p1 = new B();
- d4.p1.sb = "B.sb (1)";
- d4.p2 = new B();
- d4.p2.sb = "B.sb (2)";
- cb.ice_response(d4.p2, d4);
- }
-
- public override void returnTest1_async(AMD_Test_returnTest1 cb, Ice.Current current)
- {
- D1 d1 = new D1();
- d1.sb = "D1.sb";
- d1.sd1 = "D1.sd1";
- D2 d2 = new D2();
- d2.pb = d1;
- d2.sb = "D2.sb";
- d2.sd2 = "D2.sd2";
- d2.pd2 = d1;
- d1.pb = d2;
- d1.pd1 = d2;
- cb.ice_response(d2, d2, d1);
- }
-
- public override void returnTest2_async(AMD_Test_returnTest2 cb, Ice.Current current)
- {
- D1 d1 = new D1();
- d1.sb = "D1.sb";
- d1.sd1 = "D1.sd1";
- D2 d2 = new D2();
- d2.pb = d1;
- d2.sb = "D2.sb";
- d2.sd2 = "D2.sd2";
- d2.pd2 = d1;
- d1.pb = d2;
- d1.pd1 = d2;
- cb.ice_response(d1, d1, d2);
- }
-
- public override void returnTest3_async(AMD_Test_returnTest3 cb, B p1, B p2, Ice.Current current)
- {
- cb.ice_response(p1);
- }
-
- public override void sequenceTest_async(AMD_Test_sequenceTest cb, SS1 p1, SS2 p2, Ice.Current current)
- {
- SS ss = new SS();
- ss.c1 = p1;
- ss.c2 = p2;
- cb.ice_response(ss);
- }
-
- public override void dictionaryTest_async(AMD_Test_dictionaryTest cb, BDict bin, Ice.Current current)
- {
- BDict bout = new BDict();
- int i;
- for(i = 0; i < 10; ++i)
- {
- B b = bin[i];
- D2 d2 = new D2();
- d2.sb = b.sb;
- d2.pb = b.pb;
- d2.sd2 = "D2";
- d2.pd2 = d2;
- bout[i * 10] = d2;
- }
- BDict r = new BDict();
- for(i = 0; i < 10; ++i)
- {
- string s = "D1." + (i * 20).ToString();
- D1 d1 = new D1();
- d1.sb = s;
- d1.pb = (i == 0 ? null : r[(i - 1) * 20]);
- d1.sd1 = s;
- d1.pd1 = d1;
- r[i * 20] = d1;
- }
- cb.ice_response(r, bout);
- }
-
- public override void throwBaseAsBase_async(AMD_Test_throwBaseAsBase cb, Ice.Current current)
- {
- BaseException be = new BaseException();
- be.sbe = "sbe";
- be.pb = new B();
- be.pb.sb = "sb";
- be.pb.pb = be.pb;
- cb.ice_exception(be);
- }
-
- public override void throwDerivedAsBase_async(AMD_Test_throwDerivedAsBase cb, Ice.Current current)
- {
- DerivedException de = new DerivedException();
- de.sbe = "sbe";
- de.pb = new B();
- de.pb.sb = "sb1";
- de.pb.pb = de.pb;
- de.sde = "sde1";
- de.pd1 = new D1();
- de.pd1.sb = "sb2";
- de.pd1.pb = de.pd1;
- de.pd1.sd1 = "sd2";
- de.pd1.pd1 = de.pd1;
- cb.ice_exception(de);
- }
-
- public override void throwDerivedAsDerived_async(AMD_Test_throwDerivedAsDerived cb, Ice.Current current)
- {
- DerivedException de = new DerivedException();
- de.sbe = "sbe";
- de.pb = new B();
- de.pb.sb = "sb1";
- de.pb.pb = de.pb;
- de.sde = "sde1";
- de.pd1 = new D1();
- de.pd1.sb = "sb2";
- de.pd1.pb = de.pd1;
- de.pd1.sd1 = "sd2";
- de.pd1.pd1 = de.pd1;
- cb.ice_exception(de);
- }
-
- public override void throwUnknownDerivedAsBase_async(AMD_Test_throwUnknownDerivedAsBase cb, Ice.Current current)
- {
- D2 d2 = new D2();
- d2.sb = "sb d2";
- d2.pb = d2;
- d2.sd2 = "sd2 d2";
- d2.pd2 = d2;
-
- UnknownDerivedException ude = new UnknownDerivedException();
- ude.sbe = "sbe";
- ude.pb = d2;
- ude.sude = "sude";
- ude.pd2 = d2;
- cb.ice_exception(ude);
- }
-
- public override void useForward_async(AMD_Test_useForward cb, Ice.Current current)
- {
- Forward f = new Forward();
- f = new Forward();
- f.h = new Hidden();
- f.h.f = f;
- cb.ice_response(f);
- }
-
- private Ice.ObjectAdapter _adapter;
-}
+// ********************************************************************** +// +// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +using System; + +public sealed class TestI : _TestDisp +{ + public TestI(Ice.ObjectAdapter adapter) + { + _adapter = adapter; + } + + public override void shutdown_async(AMD_Test_shutdown cb, Ice.Current current) + { + _adapter.getCommunicator().shutdown(); + cb.ice_response(); + } + + public override void SBaseAsObject_async(AMD_Test_SBaseAsObject cb, Ice.Current current) + { + SBase sb = new SBase(); + sb.sb = "SBase.sb"; + cb.ice_response(sb); + } + + public override void SBaseAsSBase_async(AMD_Test_SBaseAsSBase cb, Ice.Current current) + { + SBase sb = new SBase(); + sb.sb = "SBase.sb"; + cb.ice_response(sb); + } + + public override void SBSKnownDerivedAsSBase_async(AMD_Test_SBSKnownDerivedAsSBase cb, Ice.Current current) + { + SBSKnownDerived sbskd = new SBSKnownDerived(); + sbskd.sb = "SBSKnownDerived.sb"; + sbskd.sbskd = "SBSKnownDerived.sbskd"; + cb.ice_response(sbskd); + } + + public override void SBSKnownDerivedAsSBSKnownDerived_async(AMD_Test_SBSKnownDerivedAsSBSKnownDerived cb, Ice.Current current) + { + SBSKnownDerived sbskd = new SBSKnownDerived(); + sbskd.sb = "SBSKnownDerived.sb"; + sbskd.sbskd = "SBSKnownDerived.sbskd"; + cb.ice_response(sbskd); + } + + public override void SBSUnknownDerivedAsSBase_async(AMD_Test_SBSUnknownDerivedAsSBase cb, Ice.Current current) + { + SBSUnknownDerived sbsud = new SBSUnknownDerived(); + sbsud.sb = "SBSUnknownDerived.sb"; + sbsud.sbsud = "SBSUnknownDerived.sbsud"; + cb.ice_response(sbsud); + } + + public override void SUnknownAsObject_async(AMD_Test_SUnknownAsObject cb, Ice.Current current) + { + SUnknown su = new SUnknown(); + su.su = "SUnknown.su"; + cb.ice_response(su); + } + + public override void oneElementCycle_async(AMD_Test_oneElementCycle cb, Ice.Current current) + { + B b = new B(); + b.sb = "B1.sb"; + b.pb = b; + cb.ice_response(b); + } + + public override void twoElementCycle_async(AMD_Test_twoElementCycle cb, Ice.Current current) + { + B b1 = new B(); + b1.sb = "B1.sb"; + B b2 = new B(); + b2.sb = "B2.sb"; + b2.pb = b1; + b1.pb = b2; + cb.ice_response(b1); + } + + public override void D1AsB_async(AMD_Test_D1AsB cb, Ice.Current current) + { + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + cb.ice_response(d1); + } + + public override void D1AsD1_async(AMD_Test_D1AsD1 cb, Ice.Current current) + { + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + cb.ice_response(d1); + } + + public override void D2AsB_async(AMD_Test_D2AsB cb, Ice.Current current) + { + D2 d2 = new D2(); + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + D1 d1 = new D1(); + d1.pb = d2; + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + d1.pd1 = d2; + d2.pb = d1; + d2.pd2 = d1; + cb.ice_response(d2); + } + + public override void paramTest1_async(AMD_Test_paramTest1 cb, Ice.Current current) + { + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + cb.ice_response(d1, d2); + } + + public override void paramTest2_async(AMD_Test_paramTest2 cb, Ice.Current current) + { + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + cb.ice_response(d2, d1); + } + + public override void paramTest3_async(AMD_Test_paramTest3 cb, Ice.Current current) + { + D2 d2 = new D2(); + d2.sb = "D2.sb (p1 1)"; + d2.pb = null; + d2.sd2 = "D2.sd2 (p1 1)"; + + D1 d1 = new D1(); + d1.sb = "D1.sb (p1 2)"; + d1.pb = null; + d1.sd1 = "D1.sd2 (p1 2)"; + d1.pd1 = null; + d2.pd2 = d1; + + D2 d4 = new D2(); + d4.sb = "D2.sb (p2 1)"; + d4.pb = null; + d4.sd2 = "D2.sd2 (p2 1)"; + + D1 d3 = new D1(); + d3.sb = "D1.sb (p2 2)"; + d3.pb = null; + d3.sd1 = "D1.sd2 (p2 2)"; + d3.pd1 = null; + d4.pd2 = d3; + cb.ice_response(d3, d2, d4); + } + + public override void paramTest4_async(AMD_Test_paramTest4 cb, Ice.Current current) + { + D4 d4 = new D4(); + d4.sb = "D4.sb (1)"; + d4.pb = null; + d4.p1 = new B(); + d4.p1.sb = "B.sb (1)"; + d4.p2 = new B(); + d4.p2.sb = "B.sb (2)"; + cb.ice_response(d4.p2, d4); + } + + public override void returnTest1_async(AMD_Test_returnTest1 cb, Ice.Current current) + { + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + cb.ice_response(d2, d2, d1); + } + + public override void returnTest2_async(AMD_Test_returnTest2 cb, Ice.Current current) + { + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + cb.ice_response(d1, d1, d2); + } + + public override void returnTest3_async(AMD_Test_returnTest3 cb, B p1, B p2, Ice.Current current) + { + cb.ice_response(p1); + } + + public override void sequenceTest_async(AMD_Test_sequenceTest cb, SS1 p1, SS2 p2, Ice.Current current) + { + SS ss = new SS(); + ss.c1 = p1; + ss.c2 = p2; + cb.ice_response(ss); + } + + public override void dictionaryTest_async(AMD_Test_dictionaryTest cb, BDict bin, Ice.Current current) + { + BDict bout = new BDict(); + int i; + for(i = 0; i < 10; ++i) + { + B b = bin[i]; + D2 d2 = new D2(); + d2.sb = b.sb; + d2.pb = b.pb; + d2.sd2 = "D2"; + d2.pd2 = d2; + bout[i * 10] = d2; + } + BDict r = new BDict(); + for(i = 0; i < 10; ++i) + { + string s = "D1." + (i * 20).ToString(); + D1 d1 = new D1(); + d1.sb = s; + d1.pb = (i == 0 ? null : r[(i - 1) * 20]); + d1.sd1 = s; + d1.pd1 = d1; + r[i * 20] = d1; + } + cb.ice_response(r, bout); + } + + public override void throwBaseAsBase_async(AMD_Test_throwBaseAsBase cb, Ice.Current current) + { + BaseException be = new BaseException(); + be.sbe = "sbe"; + be.pb = new B(); + be.pb.sb = "sb"; + be.pb.pb = be.pb; + cb.ice_exception(be); + } + + public override void throwDerivedAsBase_async(AMD_Test_throwDerivedAsBase cb, Ice.Current current) + { + DerivedException de = new DerivedException(); + de.sbe = "sbe"; + de.pb = new B(); + de.pb.sb = "sb1"; + de.pb.pb = de.pb; + de.sde = "sde1"; + de.pd1 = new D1(); + de.pd1.sb = "sb2"; + de.pd1.pb = de.pd1; + de.pd1.sd1 = "sd2"; + de.pd1.pd1 = de.pd1; + cb.ice_exception(de); + } + + public override void throwDerivedAsDerived_async(AMD_Test_throwDerivedAsDerived cb, Ice.Current current) + { + DerivedException de = new DerivedException(); + de.sbe = "sbe"; + de.pb = new B(); + de.pb.sb = "sb1"; + de.pb.pb = de.pb; + de.sde = "sde1"; + de.pd1 = new D1(); + de.pd1.sb = "sb2"; + de.pd1.pb = de.pd1; + de.pd1.sd1 = "sd2"; + de.pd1.pd1 = de.pd1; + cb.ice_exception(de); + } + + public override void throwUnknownDerivedAsBase_async(AMD_Test_throwUnknownDerivedAsBase cb, Ice.Current current) + { + D2 d2 = new D2(); + d2.sb = "sb d2"; + d2.pb = d2; + d2.sd2 = "sd2 d2"; + d2.pd2 = d2; + + UnknownDerivedException ude = new UnknownDerivedException(); + ude.sbe = "sbe"; + ude.pb = d2; + ude.sude = "sude"; + ude.pd2 = d2; + cb.ice_exception(ude); + } + + public override void useForward_async(AMD_Test_useForward cb, Ice.Current current) + { + Forward f = new Forward(); + f = new Forward(); + f.h = new Hidden(); + f.h.f = f; + cb.ice_response(f); + } + + private Ice.ObjectAdapter _adapter; +} diff --git a/cs/test/Ice/slicing/objects/TestI.cs b/cs/test/Ice/slicing/objects/TestI.cs index 5486c20d7ba..dc5699901e2 100755 --- a/cs/test/Ice/slicing/objects/TestI.cs +++ b/cs/test/Ice/slicing/objects/TestI.cs @@ -7,312 +7,312 @@ // // ********************************************************************** -
-using System;
-
-public sealed class TestI : _TestDisp
-{
- public TestI(Ice.ObjectAdapter adapter)
- {
- _adapter = adapter;
- }
-
- public override void shutdown(Ice.Current current)
- {
- _adapter.getCommunicator().shutdown();
- }
-
- public override Ice.Object SBaseAsObject(Ice.Current current)
- {
- SBase sb = new SBase();
- sb.sb = "SBase.sb";
- return sb;
- }
-
- public override SBase SBaseAsSBase(Ice.Current current)
- {
- SBase sb = new SBase();
- sb.sb = "SBase.sb";
- return sb;
- }
-
- public override SBase SBSKnownDerivedAsSBase(Ice.Current current)
- {
- SBSKnownDerived sbskd = new SBSKnownDerived();
- sbskd.sb = "SBSKnownDerived.sb";
- sbskd.sbskd = "SBSKnownDerived.sbskd";
- return sbskd;
- }
-
- public override SBSKnownDerived SBSKnownDerivedAsSBSKnownDerived(Ice.Current current)
- {
- SBSKnownDerived sbskd = new SBSKnownDerived();
- sbskd.sb = "SBSKnownDerived.sb";
- sbskd.sbskd = "SBSKnownDerived.sbskd";
- return sbskd;
- }
-
- public override SBase SBSUnknownDerivedAsSBase(Ice.Current current)
- {
- SBSUnknownDerived sbsud = new SBSUnknownDerived();
- sbsud.sb = "SBSUnknownDerived.sb";
- sbsud.sbsud = "SBSUnknownDerived.sbsud";
- return sbsud;
- }
-
- public override Ice.Object SUnknownAsObject(Ice.Current current)
- {
- SUnknown su = new SUnknown();
- su.su = "SUnknown.su";
- return su;
- }
-
- public override B oneElementCycle(Ice.Current current)
- {
- B b = new B();
- b.sb = "B1.sb";
- b.pb = b;
- return b;
- }
-
- public override B twoElementCycle(Ice.Current current)
- {
- B b1 = new B();
- b1.sb = "B1.sb";
- B b2 = new B();
- b2.sb = "B2.sb";
- b2.pb = b1;
- b1.pb = b2;
- return b1;
- }
-
- public override B D1AsB(Ice.Current current)
- {
- D1 d1 = new D1();
- d1.sb = "D1.sb";
- d1.sd1 = "D1.sd1";
- D2 d2 = new D2();
- d2.pb = d1;
- d2.sb = "D2.sb";
- d2.sd2 = "D2.sd2";
- d2.pd2 = d1;
- d1.pb = d2;
- d1.pd1 = d2;
- return d1;
- }
-
- public override D1 D1AsD1(Ice.Current current)
- {
- D1 d1 = new D1();
- d1.sb = "D1.sb";
- d1.sd1 = "D1.sd1";
- D2 d2 = new D2();
- d2.pb = d1;
- d2.sb = "D2.sb";
- d2.sd2 = "D2.sd2";
- d2.pd2 = d1;
- d1.pb = d2;
- d1.pd1 = d2;
- return d1;
- }
-
- public override B D2AsB(Ice.Current current)
- {
- D2 d2 = new D2();
- d2.sb = "D2.sb";
- d2.sd2 = "D2.sd2";
- D1 d1 = new D1();
- d1.pb = d2;
- d1.sb = "D1.sb";
- d1.sd1 = "D1.sd1";
- d1.pd1 = d2;
- d2.pb = d1;
- d2.pd2 = d1;
- return d2;
- }
-
- public override void paramTest1(out B p1, out B p2, Ice.Current current)
- {
- D1 d1 = new D1();
- d1.sb = "D1.sb";
- d1.sd1 = "D1.sd1";
- D2 d2 = new D2();
- d2.pb = d1;
- d2.sb = "D2.sb";
- d2.sd2 = "D2.sd2";
- d2.pd2 = d1;
- d1.pb = d2;
- d1.pd1 = d2;
- p1 = d1;
- p2 = d2;
- }
-
- public override void paramTest2(out B p1, out B p2, Ice.Current current)
- {
- paramTest1(out p2, out p1, current);
- }
-
- public override B paramTest3(out B p1, out B p2, Ice.Current current)
- {
- D2 d2 = new D2();
- d2.sb = "D2.sb (p1 1)";
- d2.pb = null;
- d2.sd2 = "D2.sd2 (p1 1)";
- p1 = d2;
-
- D1 d1 = new D1();
- d1.sb = "D1.sb (p1 2)";
- d1.pb = null;
- d1.sd1 = "D1.sd2 (p1 2)";
- d1.pd1 = null;
- d2.pd2 = d1;
-
- D2 d4 = new D2();
- d4.sb = "D2.sb (p2 1)";
- d4.pb = null;
- d4.sd2 = "D2.sd2 (p2 1)";
- p2 = d4;
-
- D1 d3 = new D1();
- d3.sb = "D1.sb (p2 2)";
- d3.pb = null;
- d3.sd1 = "D1.sd2 (p2 2)";
- d3.pd1 = null;
- d4.pd2 = d3;
-
- return d3;
- }
-
- public override B paramTest4(out B p1, Ice.Current current)
- {
- D4 d4 = new D4();
- d4.sb = "D4.sb (1)";
- d4.pb = null;
- d4.p1 = new B();
- d4.p1.sb = "B.sb (1)";
- d4.p2 = new B();
- d4.p2.sb = "B.sb (2)";
- p1 = d4;
- return d4.p2;
- }
-
- public override B returnTest1(out B p1, out B p2, Ice.Current current)
- {
- paramTest1(out p1, out p2, current);
- return p1;
- }
-
- public override B returnTest2(out B p1, out B p2, Ice.Current current)
- {
- paramTest1(out p2, out p1, current);
- return p1;
- }
-
- public override B returnTest3(B p1, B p2, Ice.Current current)
- {
- return p1;
- }
-
- public override SS sequenceTest(SS1 p1, SS2 p2, Ice.Current current)
- {
- SS ss = new SS();
- ss.c1 = p1;
- ss.c2 = p2;
- return ss;
- }
-
- public override BDict dictionaryTest(BDict bin, out BDict bout, Ice.Current current)
- {
- bout = new BDict();
- int i;
- for(i = 0; i < 10; ++i)
- {
- B b = bin[i];
- D2 d2 = new D2();
- d2.sb = b.sb;
- d2.pb = b.pb;
- d2.sd2 = "D2";
- d2.pd2 = d2;
- bout[i * 10] = d2;
- }
- BDict r = new BDict();
- for(i = 0; i < 10; ++i)
- {
- string s = "D1." + (i * 20).ToString();
- D1 d1 = new D1();
- d1.sb = s;
- d1.pb = i == 0 ? null : r[(i - 1) * 20];
- d1.sd1 = s;
- d1.pd1 = d1;
- r[i * 20] = d1;
- }
- return r;
- }
-
- public override void throwBaseAsBase(Ice.Current current)
- {
- BaseException be = new BaseException();
- be.sbe = "sbe";
- be.pb = new B();
- be.pb.sb = "sb";
- be.pb.pb = be.pb;
- throw be;
- }
-
- public override void throwDerivedAsBase(Ice.Current current)
- {
- DerivedException de = new DerivedException();
- de.sbe = "sbe";
- de.pb = new B();
- de.pb.sb = "sb1";
- de.pb.pb = de.pb;
- de.sde = "sde1";
- de.pd1 = new D1();
- de.pd1.sb = "sb2";
- de.pd1.pb = de.pd1;
- de.pd1.sd1 = "sd2";
- de.pd1.pd1 = de.pd1;
- throw de;
- }
-
- public override void throwDerivedAsDerived(Ice.Current current)
- {
- DerivedException de = new DerivedException();
- de.sbe = "sbe";
- de.pb = new B();
- de.pb.sb = "sb1";
- de.pb.pb = de.pb;
- de.sde = "sde1";
- de.pd1 = new D1();
- de.pd1.sb = "sb2";
- de.pd1.pb = de.pd1;
- de.pd1.sd1 = "sd2";
- de.pd1.pd1 = de.pd1;
- throw de;
- }
-
- public override void throwUnknownDerivedAsBase(Ice.Current current)
- {
- D2 d2 = new D2();
- d2.sb = "sb d2";
- d2.pb = d2;
- d2.sd2 = "sd2 d2";
- d2.pd2 = d2;
-
- UnknownDerivedException ude = new UnknownDerivedException();
- ude.sbe = "sbe";
- ude.pb = d2;
- ude.sude = "sude";
- ude.pd2 = d2;
- throw ude;
- }
-
- public override void useForward(out Forward f, Ice.Current current)
- {
- f = new Forward();
- f.h = new Hidden();
- f.h.f = f;
- }
-
- private Ice.ObjectAdapter _adapter;
-}
+ +using System; + +public sealed class TestI : _TestDisp +{ + public TestI(Ice.ObjectAdapter adapter) + { + _adapter = adapter; + } + + public override void shutdown(Ice.Current current) + { + _adapter.getCommunicator().shutdown(); + } + + public override Ice.Object SBaseAsObject(Ice.Current current) + { + SBase sb = new SBase(); + sb.sb = "SBase.sb"; + return sb; + } + + public override SBase SBaseAsSBase(Ice.Current current) + { + SBase sb = new SBase(); + sb.sb = "SBase.sb"; + return sb; + } + + public override SBase SBSKnownDerivedAsSBase(Ice.Current current) + { + SBSKnownDerived sbskd = new SBSKnownDerived(); + sbskd.sb = "SBSKnownDerived.sb"; + sbskd.sbskd = "SBSKnownDerived.sbskd"; + return sbskd; + } + + public override SBSKnownDerived SBSKnownDerivedAsSBSKnownDerived(Ice.Current current) + { + SBSKnownDerived sbskd = new SBSKnownDerived(); + sbskd.sb = "SBSKnownDerived.sb"; + sbskd.sbskd = "SBSKnownDerived.sbskd"; + return sbskd; + } + + public override SBase SBSUnknownDerivedAsSBase(Ice.Current current) + { + SBSUnknownDerived sbsud = new SBSUnknownDerived(); + sbsud.sb = "SBSUnknownDerived.sb"; + sbsud.sbsud = "SBSUnknownDerived.sbsud"; + return sbsud; + } + + public override Ice.Object SUnknownAsObject(Ice.Current current) + { + SUnknown su = new SUnknown(); + su.su = "SUnknown.su"; + return su; + } + + public override B oneElementCycle(Ice.Current current) + { + B b = new B(); + b.sb = "B1.sb"; + b.pb = b; + return b; + } + + public override B twoElementCycle(Ice.Current current) + { + B b1 = new B(); + b1.sb = "B1.sb"; + B b2 = new B(); + b2.sb = "B2.sb"; + b2.pb = b1; + b1.pb = b2; + return b1; + } + + public override B D1AsB(Ice.Current current) + { + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + return d1; + } + + public override D1 D1AsD1(Ice.Current current) + { + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + return d1; + } + + public override B D2AsB(Ice.Current current) + { + D2 d2 = new D2(); + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + D1 d1 = new D1(); + d1.pb = d2; + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + d1.pd1 = d2; + d2.pb = d1; + d2.pd2 = d1; + return d2; + } + + public override void paramTest1(out B p1, out B p2, Ice.Current current) + { + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + p1 = d1; + p2 = d2; + } + + public override void paramTest2(out B p1, out B p2, Ice.Current current) + { + paramTest1(out p2, out p1, current); + } + + public override B paramTest3(out B p1, out B p2, Ice.Current current) + { + D2 d2 = new D2(); + d2.sb = "D2.sb (p1 1)"; + d2.pb = null; + d2.sd2 = "D2.sd2 (p1 1)"; + p1 = d2; + + D1 d1 = new D1(); + d1.sb = "D1.sb (p1 2)"; + d1.pb = null; + d1.sd1 = "D1.sd2 (p1 2)"; + d1.pd1 = null; + d2.pd2 = d1; + + D2 d4 = new D2(); + d4.sb = "D2.sb (p2 1)"; + d4.pb = null; + d4.sd2 = "D2.sd2 (p2 1)"; + p2 = d4; + + D1 d3 = new D1(); + d3.sb = "D1.sb (p2 2)"; + d3.pb = null; + d3.sd1 = "D1.sd2 (p2 2)"; + d3.pd1 = null; + d4.pd2 = d3; + + return d3; + } + + public override B paramTest4(out B p1, Ice.Current current) + { + D4 d4 = new D4(); + d4.sb = "D4.sb (1)"; + d4.pb = null; + d4.p1 = new B(); + d4.p1.sb = "B.sb (1)"; + d4.p2 = new B(); + d4.p2.sb = "B.sb (2)"; + p1 = d4; + return d4.p2; + } + + public override B returnTest1(out B p1, out B p2, Ice.Current current) + { + paramTest1(out p1, out p2, current); + return p1; + } + + public override B returnTest2(out B p1, out B p2, Ice.Current current) + { + paramTest1(out p2, out p1, current); + return p1; + } + + public override B returnTest3(B p1, B p2, Ice.Current current) + { + return p1; + } + + public override SS sequenceTest(SS1 p1, SS2 p2, Ice.Current current) + { + SS ss = new SS(); + ss.c1 = p1; + ss.c2 = p2; + return ss; + } + + public override BDict dictionaryTest(BDict bin, out BDict bout, Ice.Current current) + { + bout = new BDict(); + int i; + for(i = 0; i < 10; ++i) + { + B b = bin[i]; + D2 d2 = new D2(); + d2.sb = b.sb; + d2.pb = b.pb; + d2.sd2 = "D2"; + d2.pd2 = d2; + bout[i * 10] = d2; + } + BDict r = new BDict(); + for(i = 0; i < 10; ++i) + { + string s = "D1." + (i * 20).ToString(); + D1 d1 = new D1(); + d1.sb = s; + d1.pb = i == 0 ? null : r[(i - 1) * 20]; + d1.sd1 = s; + d1.pd1 = d1; + r[i * 20] = d1; + } + return r; + } + + public override void throwBaseAsBase(Ice.Current current) + { + BaseException be = new BaseException(); + be.sbe = "sbe"; + be.pb = new B(); + be.pb.sb = "sb"; + be.pb.pb = be.pb; + throw be; + } + + public override void throwDerivedAsBase(Ice.Current current) + { + DerivedException de = new DerivedException(); + de.sbe = "sbe"; + de.pb = new B(); + de.pb.sb = "sb1"; + de.pb.pb = de.pb; + de.sde = "sde1"; + de.pd1 = new D1(); + de.pd1.sb = "sb2"; + de.pd1.pb = de.pd1; + de.pd1.sd1 = "sd2"; + de.pd1.pd1 = de.pd1; + throw de; + } + + public override void throwDerivedAsDerived(Ice.Current current) + { + DerivedException de = new DerivedException(); + de.sbe = "sbe"; + de.pb = new B(); + de.pb.sb = "sb1"; + de.pb.pb = de.pb; + de.sde = "sde1"; + de.pd1 = new D1(); + de.pd1.sb = "sb2"; + de.pd1.pb = de.pd1; + de.pd1.sd1 = "sd2"; + de.pd1.pd1 = de.pd1; + throw de; + } + + public override void throwUnknownDerivedAsBase(Ice.Current current) + { + D2 d2 = new D2(); + d2.sb = "sb d2"; + d2.pb = d2; + d2.sd2 = "sd2 d2"; + d2.pd2 = d2; + + UnknownDerivedException ude = new UnknownDerivedException(); + ude.sbe = "sbe"; + ude.pb = d2; + ude.sude = "sude"; + ude.pd2 = d2; + throw ude; + } + + public override void useForward(out Forward f, Ice.Current current) + { + f = new Forward(); + f.h = new Hidden(); + f.h.f = f; + } + + private Ice.ObjectAdapter _adapter; +} |