summaryrefslogtreecommitdiff
path: root/cpp/test/uwp/controller/ViewController.xaml.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/uwp/controller/ViewController.xaml.cpp')
-rw-r--r--cpp/test/uwp/controller/ViewController.xaml.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/cpp/test/uwp/controller/ViewController.xaml.cpp b/cpp/test/uwp/controller/ViewController.xaml.cpp
index 1ef4f5797f1..da938e00798 100644
--- a/cpp/test/uwp/controller/ViewController.xaml.cpp
+++ b/cpp/test/uwp/controller/ViewController.xaml.cpp
@@ -346,6 +346,7 @@ ControllerHelper::ControllerHelper(ViewController^ controller)
initData.properties = Ice::createProperties();
initData.properties->setProperty("Ice.ThreadPool.Server.SizeMax", "10");
initData.properties->setProperty("Ice.Default.Host", "127.0.0.1");
+ initData.properties->setProperty("Ice.Override.ConnectTimeout", "1000");
//initData.properties->setProperty("Ice.Trace.Network", "3");
//initData.properties->setProperty("Ice.Trace.Protocol", "1");
initData.properties->setProperty("ControllerAdapter.AdapterId", Ice::generateUUID());
@@ -369,18 +370,33 @@ ControllerHelper::registerProcessController(ViewController^ controller,
const shared_ptr<ProcessControllerRegistryPrx>& registry,
const shared_ptr<ProcessControllerPrx>& processController)
{
- registry->setProcessControllerAsync(processController,
+ registry->ice_pingAsync(
[this, controller, adapter, registry, processController]()
{
auto connection = registry->ice_getCachedConnection();
connection->setAdapter(adapter);
connection->setACM(5, Ice::ACMClose::CloseOff, Ice::ACMHeartbeat::HeartbeatAlways);
connection->setCloseCallback([=](const shared_ptr<Ice::Connection>&)
- {
- controller->println("connection with process controller registry closed");
- std::this_thread::sleep_for(2s);
- registerProcessController(controller, adapter, registry, processController);
- });
+ {
+ controller->println("connection with process controller registry closed");
+ std::this_thread::sleep_for(2s);
+ registerProcessController(controller, adapter, registry, processController);
+ });
+
+ registry->setProcessControllerAsync(processController, nullptr,
+ [controller](exception_ptr e)
+ {
+ try
+ {
+ rethrow_exception(e);
+ }
+ catch(const std::exception& ex)
+ {
+ ostringstream os;
+ os << "unexpected exception while connecting to process controller registry:\n" << ex.what();
+ controller->println(os.str());
+ }
+ });
},
[this, controller, adapter, registry, processController](exception_ptr e)
{