EventableDescriptor::~EventableDescriptor() { if (EventCallback && bCallbackUnbind) (*EventCallback)(GetBinding().c_str(), EM_CONNECTION_UNBOUND, NULL, UnbindReasonCode); StopProxy(); Close(); }
void mtsManagerProxyClient::OnServerDisconnect(const Ice::Exception & ex) { // Multiple proxy threads can detect server disconnect static osaCriticalSection cs; cs.Enter(); if (!IsActiveProxy() || !ProxyOwner->IsGCMActive()) { cs.Leave(); return; // already detected disconnection } // Ice - ConnectionLostException - forceful closure by peer // Ice - ForcedCloseConnectionException - after forceful closure by peer CMN_LOG_CLASS_RUN_WARNING << ex << std::endl; CMN_LOG_CLASS_RUN_ERROR << "Process \"" << ProxyOwner->GetProcessName() << "\" detected GLOBAL COMPONENT MANAGER DISCONNECTION" << std::endl; StopProxy(); // GCM has been disconnected ProxyOwner->SetGCMConnected(false); cs.Leave(); }
mtsManagerProxyClient::~mtsManagerProxyClient() { StopProxy(); #if IMPROVE_ICE_THREADING delete IceThreadInitEvent; #endif }
void EventableDescriptor::StartProxy(const char *to) { EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (to)); if (ed) { StopProxy(); ProxyTarget = strdup(to); return; } throw std::runtime_error ("Tried to proxy to an invalid descriptor"); }
void EventableDescriptor::_GenericInboundDispatch(const char *buf, int size) { assert(EventCallback); if (!ProxyTarget) (*EventCallback)(GetBinding().c_str(), EM_CONNECTION_READ, buf, size); else if (ConnectionDescriptor::SendDataToConnection(ProxyTarget, buf, size) == -1) { (*EventCallback)(GetBinding().c_str(), EM_PROXY_TARGET_UNBOUND, NULL, 0); StopProxy(); } }
void EventableDescriptor::StartProxy(const unsigned long to, const unsigned long bufsize, const unsigned long length) { EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (to)); if (ed) { StopProxy(); ProxyTarget = ed; BytesToProxy = length; ed->SetProxiedFrom(this, bufsize); return; } throw std::runtime_error ("Tried to proxy to an invalid descriptor"); }
EventableDescriptor::~EventableDescriptor() { if (NextHeartbeat) MyEventMachine->ClearHeartbeat(NextHeartbeat); if (EventCallback && bCallbackUnbind) (*EventCallback)(GetBinding(), EM_CONNECTION_UNBOUND, NULL, UnbindReasonCode); if (ProxiedFrom) { (*EventCallback)(ProxiedFrom->GetBinding(), EM_PROXY_TARGET_UNBOUND, NULL, 0); ProxiedFrom->StopProxy(); } StopProxy(); Close(); }
void EventableDescriptor::_GenericInboundDispatch(const char *buf, int size) { assert(EventCallback); if (ProxyTarget) { if (BytesToProxy > 0) { unsigned long proxied = std::min(BytesToProxy, (unsigned long) size); ProxyTarget->SendOutboundData(buf, proxied); BytesToProxy -= proxied; if (BytesToProxy == 0) { StopProxy(); (*EventCallback)(GetBinding(), EM_PROXY_COMPLETED, NULL, 0); if (proxied < size) { (*EventCallback)(GetBinding(), EM_CONNECTION_READ, buf + proxied, size - proxied); } } } else { ProxyTarget->SendOutboundData(buf, size); } } else { (*EventCallback)(GetBinding(), EM_CONNECTION_READ, buf, size); } }