summaryrefslogtreecommitdiff
path: root/csharp/test/Ice/binding/RemoteCommunicatorI.cs
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2017-11-07 13:27:14 +0100
committerJose <jose@zeroc.com>2017-11-07 13:27:14 +0100
commitab399941ef3f4db14061ebe2ae77e779c482aeae (patch)
tree0924ffbb4b76f3b99db20aa38296011138b6f850 /csharp/test/Ice/binding/RemoteCommunicatorI.cs
parentJS Ice/binding hang on macOS (diff)
downloadice-ab399941ef3f4db14061ebe2ae77e779c482aeae.tar.bz2
ice-ab399941ef3f4db14061ebe2ae77e779c482aeae.tar.xz
ice-ab399941ef3f4db14061ebe2ae77e779c482aeae.zip
Fix JS Ice/binding failure
Bug ICE-8551 With JS browser the test can fail if browser listen on a port that is used by the server, that was the case with Chrome. The test not retry the creation of the object adapter if it fails with a SocketException
Diffstat (limited to 'csharp/test/Ice/binding/RemoteCommunicatorI.cs')
-rw-r--r--csharp/test/Ice/binding/RemoteCommunicatorI.cs29
1 files changed, 20 insertions, 9 deletions
diff --git a/csharp/test/Ice/binding/RemoteCommunicatorI.cs b/csharp/test/Ice/binding/RemoteCommunicatorI.cs
index c556cea0dc3..0436be2a480 100644
--- a/csharp/test/Ice/binding/RemoteCommunicatorI.cs
+++ b/csharp/test/Ice/binding/RemoteCommunicatorI.cs
@@ -20,17 +20,28 @@ public class RemoteCommunicatorI : RemoteCommunicatorDisp_
public override RemoteObjectAdapterPrx
createObjectAdapter(string name, string endpts, Ice.Current current)
{
- string endpoints = endpts;
- if(endpoints.IndexOf("-p") < 0)
+ int retry = 5;
+ try
{
- endpoints = _app.getTestEndpoint(_nextPort++, endpoints);
+ string endpoints = endpts;
+ if(endpoints.IndexOf("-p") < 0)
+ {
+ endpoints = _app.getTestEndpoint(_nextPort++, endpoints);
+ }
+
+ Ice.Communicator com = current.adapter.getCommunicator();
+ com.getProperties().setProperty(name + ".ThreadPool.Size", "1");
+ Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, endpoints);
+ return RemoteObjectAdapterPrxHelper.uncheckedCast(
+ current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter)));
+ }
+ catch(Ice.SocketException)
+ {
+ if(--retry == 0)
+ {
+ throw;
+ }
}
-
- Ice.Communicator com = current.adapter.getCommunicator();
- com.getProperties().setProperty(name + ".ThreadPool.Size", "1");
- Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, endpoints);
- return RemoteObjectAdapterPrxHelper.uncheckedCast(
- current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter)));
}
public override void