summaryrefslogtreecommitdiff
path: root/cppe/demo/IceE/chat/ChatClientDlg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cppe/demo/IceE/chat/ChatClientDlg.cpp')
-rw-r--r--cppe/demo/IceE/chat/ChatClientDlg.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/cppe/demo/IceE/chat/ChatClientDlg.cpp b/cppe/demo/IceE/chat/ChatClientDlg.cpp
index 1208ce80590..50f60f7ae47 100644
--- a/cppe/demo/IceE/chat/ChatClientDlg.cpp
+++ b/cppe/demo/IceE/chat/ChatClientDlg.cpp
@@ -341,29 +341,24 @@ CChatClientDlg::OnLogin()
try
{
string routerStr = Ice::printfToString("Glacier2/router:tcp -p %s -h %s", port.c_str(), host.c_str());
- Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(_communicator->stringToProxy(routerStr));
- assert(router);
+ _router = Glacier2::RouterPrx::checkedCast(_communicator->stringToProxy(routerStr));
+ assert(_router);
//
- // Set the router on the Communicator.
+ // Now setup the new router.
//
- _communicator->setDefaultRouter(router);
-
- //Ice::PropertiesPtr properties = _communicator->getProperties();
- //properties->setProperty("Chat.Client.Router", routerStr);
-
- _chat = ChatSessionPrx::uncheckedCast(router->createSession(user, password));
+ _chat = ChatSessionPrx::uncheckedCast(_router->createSession(user, password)->ice_router(_router));
//
// Add the new router to the object adapter.
//
- _adapter->addRouter(router);
+ _adapter->addRouter(_router);
//
// Create the callback object. This must have the
// category as defined by the Glacier2 session.
//
- string category = router->getServerProxy()->ice_getIdentity().category;
+ string category = _router->getServerProxy()->ice_getIdentity().category;
Ice::Identity callbackReceiverIdent;
callbackReceiverIdent.name = "callbackReceiver";
callbackReceiverIdent.category = category;
@@ -397,7 +392,7 @@ CChatClientDlg::OnLogin()
assert(_callback);
_adapter->remove(_callback->ice_getIdentity());
_callback = 0;
-
+
assert(_chat);
_chat = 0;
@@ -408,14 +403,21 @@ CChatClientDlg::OnLogin()
_ping->getThreadControl().join();
_ping = 0;
+ //
+ // Clear the router.
+ //
+ assert(_router);
try
{
- Glacier2::RouterPrx::uncheckedCast(_communicator->getDefaultRouter())->destroySession();
+ _router->destroySession();
}
catch(const Ice::Exception& ex)
{
AfxMessageBox(CString(ex.toString().c_str()), MB_OK|MB_ICONEXCLAMATION);
}
+
+ _adapter->removeRouter(_router);
+ _router = 0;
}
//