diff options
author | Matthew Newhook <matthew@zeroc.com> | 2005-09-19 07:23:38 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2005-09-19 07:23:38 +0000 |
commit | b93783c5787ebf9bc9ef3d6579d389bcc7af9398 (patch) | |
tree | 913efa3db1c22775c54f174d52db42a34913d057 /cppe/demo/IceE/chat/ChatClientDlg.cpp | |
parent | http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=459 (diff) | |
download | ice-b93783c5787ebf9bc9ef3d6579d389bcc7af9398.tar.bz2 ice-b93783c5787ebf9bc9ef3d6579d389bcc7af9398.tar.xz ice-b93783c5787ebf9bc9ef3d6579d389bcc7af9398.zip |
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=435. added
removeRouter().
Diffstat (limited to 'cppe/demo/IceE/chat/ChatClientDlg.cpp')
-rw-r--r-- | cppe/demo/IceE/chat/ChatClientDlg.cpp | 28 |
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; } // |