void Client::handleOutputError(const Event&, void*) { cleanupTimer(); cleanupScreen(); cleanupConnection(); LOG((CLOG_WARN "error sending to server")); sendEvent(m_events->forClient().disconnected(), NULL); }
void Client::handleDisconnected(const Event&, void*) { cleanupTimer(); cleanupScreen(); cleanupConnection(); LOG((CLOG_DEBUG1 "disconnected")); sendEvent(m_events->forClient().disconnected(), NULL); }
void CClient::handleDisconnected(const CEvent&, void*) { cleanupTimer(); cleanupScreen(); cleanupConnection(); LOG((CLOG_DEBUG1 "disconnected")); sendEvent(getDisconnectedEvent(), NULL); }
void CClient::handleOutputError(const CEvent&, void*) { cleanupTimer(); cleanupScreen(); cleanupConnection(); LOG((CLOG_WARN "error sending to server")); sendEvent(getDisconnectedEvent(), NULL); }
void Client::handleConnectTimeout(const Event&, void*) { cleanupTimer(); cleanupConnecting(); cleanupConnection(); cleanupStream(); LOG((CLOG_DEBUG1 "connection timed out")); sendConnectionFailedEvent("Timed out"); }
void CClient::handleConnectTimeout(const CEvent&, void*) { cleanupTimer(); cleanupConnecting(); cleanupConnection(); delete m_stream; m_stream = NULL; LOG((CLOG_DEBUG1 "connection timed out")); sendConnectionFailedEvent("Timed out"); }
void Client::handleHello(const Event&, void*) { SInt16 major, minor; if (!ProtocolUtil::readf(m_stream, kMsgHello, &major, &minor)) { sendConnectionFailedEvent("Protocol error from server, check encryption settings"); cleanupTimer(); cleanupConnection(); return; } // check versions LOG((CLOG_DEBUG1 "got hello version %d.%d", major, minor)); if (major < kProtocolMajorVersion || (major == kProtocolMajorVersion && minor < kProtocolMinorVersion)) { sendConnectionFailedEvent(XIncompatibleClient(major, minor).what()); cleanupTimer(); cleanupConnection(); return; } // say hello back LOG((CLOG_DEBUG1 "say hello version %d.%d", kProtocolMajorVersion, kProtocolMinorVersion)); ProtocolUtil::writef(m_stream, kMsgHelloBack, kProtocolMajorVersion, kProtocolMinorVersion, &m_name); // now connected but waiting to complete handshake setupScreen(); cleanupTimer(); // make sure we process any remaining messages later. we won't // receive another event for already pending messages so we fake // one. if (m_stream->isReady()) { m_events->addEvent(Event(m_events->forIStream().inputReady(), m_stream->getEventTarget())); } }
int main(int argc, char *argv[]) { MLENV env; MLINK link; int ierr; ierr = PetscInitialize(&argc, &argv, NULL, help);if (ierr) return(ierr); ierr = setupConnection(&env, &link, "192.168.119.1", MATHEMATICA_LINK_CONNECT);CHKERRQ(ierr); ierr = processPackets(link);CHKERRQ(ierr); ierr = cleanupConnection(env, link);CHKERRQ(ierr); ierr = PetscFinalize(); return(ierr); }
CClient::~CClient() { EVENTQUEUE->removeHandler(IScreen::getSuspendEvent(), getEventTarget()); EVENTQUEUE->removeHandler(IScreen::getResumeEvent(), getEventTarget()); cleanupTimer(); cleanupScreen(); cleanupConnecting(); cleanupConnection(); delete m_socketFactory; delete m_streamFilterFactory; }
void Client::disconnect(const char* msg) { m_connectOnResume = false; cleanupTimer(); cleanupScreen(); cleanupConnecting(); cleanupConnection(); if (msg != NULL) { sendConnectionFailedEvent(msg); } else { sendEvent(m_events->forClient().disconnected(), NULL); } }
Client::~Client() { if (m_mock) { return; } m_events->removeHandler(m_events->forIScreen().suspend(), getEventTarget()); m_events->removeHandler(m_events->forIScreen().resume(), getEventTarget()); cleanupTimer(); cleanupScreen(); cleanupConnecting(); cleanupConnection(); delete m_socketFactory; }
CClient::~CClient() { // HACK: can't disable dtor with mocks if (m_mock) return; m_eventQueue.removeHandler(IScreen::getSuspendEvent(), getEventTarget()); m_eventQueue.removeHandler(IScreen::getResumeEvent(), getEventTarget()); cleanupTimer(); cleanupScreen(); cleanupConnecting(); cleanupConnection(); delete m_socketFactory; delete m_streamFilterFactory; }