Remote::Remote(Player* player, QObject* parent) : QObject(parent), player_(player), connection_(new xrme::Connection(this)), retry_count_(0) { connection_->SetMediaPlayer(this); connection_->SetMediaStorage(this); connection_->set_verbose(true); connect(connection_, SIGNAL(Connected()), SLOT(Connected())); connect(connection_, SIGNAL(Disconnected(QString)), SLOT(Disconnected(QString))); connect(player_, SIGNAL(Playing()), SLOT(SetStateChanged())); connect(player_, SIGNAL(Paused()), SLOT(SetStateChanged())); connect(player_, SIGNAL(Stopped()), SLOT(SetStateChanged())); connect(player_, SIGNAL(PlaylistFinished()), SLOT(SetStateChanged())); connect(player_, SIGNAL(VolumeChanged(int)), SLOT(SetStateChanged())); connect(player_, SIGNAL(Seeked(qlonglong)), SLOT(SetStateChanged())); connect(player_->playlists(), SIGNAL(CurrentSongChanged(Song)), SLOT(SetStateChanged())); connect(connection_, SIGNAL(TomahawkSIPReceived(const QVariant&)), SLOT(TomahawkSIPReceived(const QVariant&))); ReloadSettings(); }
TApplication::TApplication(int& argc, char* argv[]) : QApplication(argc, argv) , MainDisplay(this) , Network(new TNetwork(this)) , Settings(new TSettings(this)) , State(ST_MainMenu) { connect(Network, SIGNAL(WorldReceived()), &MainDisplay, SLOT(RedrawWorld())); connect(Network, SIGNAL(Disconnected()), SLOT(Disconnected())); }
void QmitkToolPairNavigationView::CreateConnections() { connect( m_NDIConfigWidget, SIGNAL(Connected()), this, SLOT(SetNavigationUp())); connect( m_NDIConfigWidget, SIGNAL(Connected()), this->m_Controls.m_RenderingTimerWidget, SLOT(EnableWidget())); connect( m_NDIConfigWidget, SIGNAL(Disconnected()), this, SLOT(Disconnected())); connect( m_NDIConfigWidget, SIGNAL(Disconnected()), this->m_Controls.m_RenderingTimerWidget, SLOT(DisableWidget())); //to be implemented for tool name changig e.g. // connect(m_NDIConfigWidget, SIGNAL(ToolsChanged()), this, SLOT(ToolsChanged())); }
bool CCBListener::SendMsgToCCB(ClassAd &msg,bool blocking) { if( !m_sock ) { Daemon ccb(DT_COLLECTOR,m_ccb_address.Value()); int cmd = -1; msg.LookupInteger( ATTR_COMMAND, cmd ); if( cmd != CCB_REGISTER ) { dprintf(D_ALWAYS,"CCBListener: no connection to CCB server %s" " when trying to send command %d\n", m_ccb_address.Value(), cmd ); return false; } // Specifying USE_TMP_SEC_SESSION to force a fresh security // session. Otherwise we can end up in a catch-22 where we // are trying to reconnect to the CCB server and we try to use // a cached security session which is no longer valid, but our // CCB server cannot send us the invalidation message because // we are trying to reconnect to it. Expring this session // right away is also a good idea, because if we are just // starting up, the return address associated with it will not // have any CCB information attached, which again means that // the CCB server has no way to invalidate it. if( blocking ) { m_sock = ccb.startCommand( cmd, Stream::reli_sock, CCB_TIMEOUT, NULL, NULL, false, USE_TMP_SEC_SESSION ); if( m_sock ) { Connected(); } else { Disconnected(); return false; } } else if( !m_waiting_for_connect ) { m_sock = ccb.makeConnectedSocket(Stream::reli_sock, CCB_TIMEOUT, 0, NULL, true /*nonblocking*/ ); if( !m_sock ) { Disconnected(); return false; } m_waiting_for_connect = true; incRefCount(); // do not let ourselves be deleted until called back ccb.startCommand_nonblocking( cmd, m_sock, CCB_TIMEOUT, NULL, CCBListener::CCBConnectCallback, this, NULL, false, USE_TMP_SEC_SESSION ); return false; } } return WriteMsgToCCB(msg); }
Game::Game(QString address) { this->cup=new Cup(); this->settings=aSetInstance; connect(this,SIGNAL(PlayerPointChanged(uchar,int)),cup,SLOT(ChangePlayerPoint(uchar,int))); map=0; serverconnection=0; clientconnection=new Client(settings->defaultPlayer1Name); connect(this,SIGNAL(ClientValidate(Command)),clientconnection,SLOT(SendCommandToServer(Command))); connect(clientconnection,SIGNAL(CommandReceivedFromServer(Command)),this,SLOT(ServerExecute(Command))); connect(clientconnection,SIGNAL(Connected()),this,SIGNAL(Connected())); connect(clientconnection,SIGNAL(ConnectionFailed()),this,SIGNAL(ConnectionFailed())); connect(clientconnection,SIGNAL(refreshPlayers()), this, SIGNAL(RefreshPlayers())); connect(this,SIGNAL(PlayerPointChanged(uchar,int)),cup,SLOT(ChangePlayerPoint(uchar,int))); connect(clientconnection,SIGNAL(Disconnected()),this,SIGNAL(Disconnected())); }
void PopSession::ShutdownConnection() { // shutting down connection if (m_connection.get()) { m_connection->Shutdown(); } // TODO: should do the following actions in a callback function to socket's WatchClosed() function // reset line reader, input/output streem and connection. m_lineReader.reset(NULL); m_inputStream.reset(NULL); m_outputStream.reset(NULL); m_connection.reset(NULL); // reset UID map m_uidMap.reset(new UidMap()); // once disconnected, change the state to need connection m_state = State_NeedsConnection; // mark the pop session as disconnected if(m_reconnect && m_commandManager->GetPendingCommandCount()>0) { m_reconnect = false; CheckQueue(); } else { Disconnected(); } }
Game::Game(uchar playersnumber,int bombtimeout,ArawnSettings *settings,bool survive) { activegame=false; this->cup=0; this->survive=survive; this->settings=settings; this->playersnumber=playersnumber; this->bombtimeout=bombtimeout; this->playerid=0; gametimer=new QTimer(this); destroymap=new QTimer(this); map=new Map(playersnumber,settings); map->Upload(1); clientconnection=0; serverconnection=new Servernet(); serverconnection->SetSurviveCup(survive); serverconnection->SetPlayerNumber(playersnumber); serverconnection->SetLocalPlayername(settings->defaultPlayer1Name); connect(map,SIGNAL(ServerCommand(Command)),this,SIGNAL(ServerValidate(Command))); connect(this,SIGNAL(ClientValidate(Command)),this,SLOT(ClientExecute(Command))); connect(this,SIGNAL(ServerValidate(Command)),serverconnection,SLOT(SendCommandToClients(Command))); connect(this,SIGNAL(ServerValidate(Command)),this,SLOT(ServerExecute(Command))); connect(serverconnection,SIGNAL(CommandReceivedFromClients(Command)),this,SLOT(ClientExecute(Command))); connect(serverconnection,SIGNAL(ServerIsRunning()),this,SIGNAL(ServerIsRunning())); connect(serverconnection,SIGNAL(NewPlayerConnected()),this,SIGNAL(NewPlayer())); connect(serverconnection,SIGNAL(ServerNetworkError()),this,SIGNAL(ConnectionFailed())); connect(serverconnection,SIGNAL(AllPlayersConnected()),this,SLOT(AllReady())); connect(this,SIGNAL(FieldDestroyedByMap(uchar,uchar)),map,SIGNAL(FieldDestroyed(uchar,uchar))); connect(serverconnection,SIGNAL(PlayerDisconnected()),this,SIGNAL(Disconnected())); }
void CIPCServer::AddSocket(CIPCSocket* pSocket) { pSocket->setParent(this); connect(pSocket, SIGNAL(Disconnected()), this, SLOT(OnDisconnected())); connect(pSocket, SIGNAL(Request(const QString&, const QVariant&, qint64)), this, SLOT(OnRequest(const QString&, const QVariant&, qint64))); m_Clients.append(pSocket); }
//------------------------------------------------------------------------- int Handler::Handle( Asev::Event &e ) { if( e.Info() != typeid( Event ) ) return 0; #define GETERROR static_cast<ErrorEvent&>(e).GetError() int result = 0; Event &stream_event = static_cast<Event&>(e); switch( stream_event.m_class ) { case Event::ACCEPTED: Accepted( stream_event.m_stream ); break; case Event::ACCEPTERROR: AcceptError( stream_event.m_stream, GETERROR ); break; case Event::CONNECTED: Connected( stream_event.m_stream ); break; case Event::CONNECTERROR: ConnectError( stream_event.m_stream, GETERROR ); break; case Event::DISCONNECTED: Disconnected( stream_event.m_stream, GETERROR ); break; case Event::RECEIVE: Receive( stream_event.m_stream, static_cast<Event::Receive&>(e).GetMessage() ); break; case Event::SENDFAILED: SendFailed( stream_event.m_stream, GETERROR ); break; } return result; }
void Connection::HandleEdgeClose() { Edge *edge = qobject_cast<Edge *>(sender()); if(edge == _edge.data()) { emit Disconnected(edge->GetStoppedReason()); } }
void MainWindow::Disconnect() { delete audio; audio = NULL; clientMutex.lock(); client.Disconnect(); QString workDirPath = QString::fromUtf8(client.GetWorkDir()); bool keepWorkDir = client.config_savelocalaudio; client.SetWorkDir(NULL); clientMutex.unlock(); if (!workDirPath.isEmpty() && !keepWorkDir) { cleanupWorkDir(workDirPath); chatAddLine("Disconnected", ""); } setWindowTitle(tr("Wahjam")); audioConfigAction->setEnabled(true); connectAction->setEnabled(true); disconnectAction->setEnabled(false); BeatsPerMinuteChanged(0); BeatsPerIntervalChanged(0); emit Disconnected(); }
void ConnectionManager::HandleEdgeClose() { Edge *edge = qobject_cast<Edge *>(sender()); _active_addrs.remove(edge->GetRemoteAddress()); qDebug() << "Edge closed: " << edge->ToString() << edge->GetStoppedReason(); if(!_con_tab.RemoveEdge(edge)) { qWarning() << "Edge closed but no Edge found in CT:" << edge->ToString(); } QSharedPointer<Connection> con = _con_tab.GetConnection(edge); if(con) { con = _con_tab.GetConnection(con->GetRemoteId()); if(con) { con->Disconnect(); } } if(!Stopped()) { return; } if(_con_tab.GetEdges().count() == 0) { emit Disconnected(); } }
void EHSConnection::SendHttpResponse ( HttpResponse * ipoHttpResponse ) { // only send it if the client isn't disconnected if ( Disconnected ( ) ) { return; } std::string sOutput; char psSmallBuffer [ 20 ]; sOutput = "HTTP/1.1 "; // add in the response code sprintf ( psSmallBuffer, "%d", ipoHttpResponse->m_nResponseCode ); sOutput += psSmallBuffer; sOutput += " "; sOutput += GetResponsePhrase ( ipoHttpResponse->m_nResponseCode ); sOutput += "\r\n"; // now go through all the entries in the responseheaders string map for ( StringMap::iterator oCurrentHeader = ipoHttpResponse->oResponseHeaders.begin ( ); oCurrentHeader != ipoHttpResponse->oResponseHeaders.end ( ); oCurrentHeader++ ) { sOutput += (*oCurrentHeader).first; sOutput += ": "; sOutput += (*oCurrentHeader).second; sOutput += "\r\n"; } // now push out all the cookies for ( StringList::iterator i = ipoHttpResponse->oCookieList.begin ( ); i != ipoHttpResponse->oCookieList.end ( ); i++ ) { sOutput += "Set-Cookie: "; sOutput += *i; sOutput += "\r\n"; } // extra line break signalling end of headers sOutput += "\r\n"; int ret = TrySend ( sOutput.c_str (), sOutput.length() ); if ( ret == -1 ) return; // now send the body TrySend ( ipoHttpResponse->GetBody ( ), atoi ( ipoHttpResponse->oResponseHeaders [ "content-length" ].c_str ( ) ) ); }
void Connection::HandleEdgeClose(const QString &reason) { Edge *edge = qobject_cast<Edge *>(sender()); if(edge == _edge.data()) { emit Disconnected(reason); delete this; } }
void FileTransferWidget::ClientConnected() { m_socket = m_server->nextPendingConnection(); connect(m_socket,SIGNAL(readyRead()),this,SLOT(ReadyRead())); connect(m_socket,SIGNAL(disconnected()),this,SLOT(Disconnected())); connect(m_socket,SIGNAL(bytesWritten(qint64)),this,SLOT(FileBytesWritten(qint64))); m_currentStatus = FT_WAIT_FOR_HELLO; m_server->close(); }
void EkosManager::processLocalDevice(ISD::GDInterface *devInterface) { DriverInfo *di = devInterface->getDriverInfo(); switch (di->getType()) { case KSTARS_TELESCOPE: scope = devInterface; break; case KSTARS_CCD: if (guider_di == di) { guider = devInterface; guiderName = devInterface->getDeviceName(); } else ccd = devInterface; break; case KSTARS_FOCUSER: focuser = devInterface; break; case KSTARS_FILTER: if (filter_di == di) filter = devInterface; if (useFilterFromCCD) ccd = devInterface; break; case KSTARS_AUXILIARY: if (aux_di == di) aux = devInterface; break; default: return; break; } nDevices--; connect(devInterface, SIGNAL(Connected()), this, SLOT(deviceConnected())); connect(devInterface, SIGNAL(Disconnected()), this, SLOT(deviceDisconnected())); connect(devInterface, SIGNAL(propertyDefined(INDI::Property*)), this, SLOT(processNewProperty(INDI::Property*))); if (nDevices == 0) { connectB->setEnabled(true); disconnectB->setEnabled(false); controlPanelB->setEnabled(true); } }
Client::Client(QString name) { this->name=name; socket = new QTcpSocket(this); connect(socket, SIGNAL(readyRead()), this, SLOT(readyRead())); connect(socket, SIGNAL(connected()), this, SIGNAL(Connected())); connect(socket, SIGNAL(connected()), this, SLOT(SendUsernameToServer())); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(ConnectionFailed())); connect(socket,SIGNAL(disconnected()),this,SIGNAL(Disconnected())); }
IP_Connection::IP_Connection(QObject *parent) : QObject(parent) { IP_Init(); connect(socket, SIGNAL(connected()), this, SIGNAL(Connected())); connect(socket, SIGNAL(disconnected()), this, SIGNAL(Disconnected())); connect(socket, SIGNAL(disconnected()), this, SLOT(sdisconnected())); connect(socket, SIGNAL(readyRead()), this, SIGNAL(dataReceived())); }
void ArduinoThread::NewConnection() { sock = serv->nextPendingConnection(); if(!sock) return; connect(sock, SIGNAL(disconnected()), this, SLOT(Disconnected())); emit SocketConnected(); }
void IsuCalcLink::Initialize() { Socket = new QTcpSocket; connect(Socket, SIGNAL(connected()), this, SLOT(Connected())); connect(Socket, SIGNAL(disconnected()), this, SLOT(Disconnected())); connect(Socket, SIGNAL(readyRead()), this, SLOT(ReadyRead())); connect(Socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(SocketError(QAbstractSocket::SocketError))); Timer = new QTimer; Timer->setSingleShot(true); connect(Timer, SIGNAL(timeout()), this, SLOT(TimerExpired())); }
void QmitkNDIConfigurationWidget::OnDisconnect() { if (m_Tracker.IsNull()) return; m_Tracker->CloseConnection(); m_Tracker = NULL; this->UpdateToolTable(); this->UpdateWidgets(); emit ToolsAdded(this->GetToolNamesList()); emit Disconnected(); this->HidePolarisOptionsGroupbox(true); this->HideAuroraOptionsGroupbox(true); }
//ACCEPTCONNECTION---------------------------------------------------------------- void MainThread::AcceptConnection() { QTcpSocket* sock= tcpServer.nextPendingConnection(); if (!cl->Add(sock)) { sock->write("#s/ser*ver#m/denial of service#/"); qCritical()<<"denial"; sock->close(); sock->deleteLater(); return; } connect(sock, SIGNAL(readyRead()),this, SLOT(Read()),Qt::QueuedConnection); connect(sock, SIGNAL(disconnected()),this, SLOT(Disconnected()),Qt::QueuedConnection); qCritical()<<"acepted "; }
bool CCBListener::WriteMsgToCCB(ClassAd &msg) { if( !m_sock || m_waiting_for_connect ) { return false; } m_sock->encode(); if( !msg.put( *m_sock ) || !m_sock->end_of_message() ) { Disconnected(); return false; } return true; }
VideoRecorderNode::~VideoRecorderNode() { BMediaEventLooper::Quit(); //delete all entrys in the List if (initStatus == B_OK) { if (filterInput.destination!=media_destination::null) Disconnected(filterInput.source, filterInput.destination); if (bitmap) delete bitmap; if (movie) delete movie; } atomic_add(&instances, -1); }
void CCBListener::HeartbeatTime() { int age = time(NULL) - m_last_contact_from_peer; if( age > 3*m_heartbeat_interval ) { dprintf(D_ALWAYS, "CCBListener: no activity from CCB server in %ds; " "assuming connection is dead.\n", age); Disconnected(); return; } dprintf(D_FULLDEBUG, "CCBListener: sent heartbeat to server.\n"); ClassAd msg; msg.Assign(ATTR_COMMAND, ALIVE); SendMsgToCCB(msg,false); }
service::service( ) { timer1 = new QTimer(this); timer1->setSingleShot(true); timer2 = new QTimer(this); timer2->setSingleShot(true); timer3 = new QTimer(this); timer3->setSingleShot(true); distimer = new QTimer(this); server = new socket; connected = false; QObject::connect( timer1, SIGNAL(timeout()), this, SLOT(JoinRaffle1()) ); QObject::connect( timer2, SIGNAL(timeout()), this, SLOT(JoinRaffle2()) ); QObject::connect( timer3, SIGNAL(timeout()), this, SLOT(JoinRaffle3()) ); QObject::connect( distimer, SIGNAL(timeout()), this, SLOT(reconnect()) ); QObject::connect( server, SIGNAL(NewData(QString)), this, SLOT(ParseString(QString)) ); QObject::connect( server, SIGNAL(Disconnected()), this, SLOT(Disconnection()) ); QObject::connect( server, SIGNAL(Connected()), this, SLOT(Connection()) ); }
void EkosManager::processRemoteDevice(ISD::GDInterface *devInterface) { if (!strcmp(devInterface->getDeviceName(), Options::remoteScopeName().toLatin1())) scope = devInterface; else if (!strcmp(devInterface->getDeviceName(), Options::remoteCCDName().toLatin1())) { ccd = devInterface; if (useGuiderFromCCD) guider = ccd; } else if (!strcmp(devInterface->getDeviceName(), Options::remoteGuiderName().toLatin1())) { guider = devInterface; guiderName = devInterface->getDeviceName(); } else if (!strcmp(devInterface->getDeviceName(), Options::remoteFocuserName().toLatin1())) focuser = devInterface; else if (!strcmp(devInterface->getDeviceName(), Options::remoteFilterName().toLatin1())) filter = devInterface; else if (!strcmp(devInterface->getDeviceName(), Options::remoteAuxName().toLatin1())) aux = devInterface; else return; nDevices--; connect(devInterface, SIGNAL(Connected()), this, SLOT(deviceConnected())); connect(devInterface, SIGNAL(Disconnected()), this, SLOT(deviceDisconnected())); connect(devInterface, SIGNAL(propertyDefined(INDI::Property*)), this, SLOT(processNewProperty(INDI::Property*))); if (nDevices == 0) { connectB->setEnabled(true); disconnectB->setEnabled(false); controlPanelB->setEnabled(true); appendLogText(i18n("Remote devices established. Please connect devices.")); } }
Renderer::Renderer(CloudRenderingPlugin *plugin) : LC("[WebRTC::Renderer]: "), plugin_(plugin), websocket_(new WebRTC::WebSocketClient(plugin)), tundraRenderer_(new TundraRenderer(plugin)) { WebRTC::RegisterMetaTypes(); connect(websocket_.get(), SIGNAL(Connected()), SLOT(OnServiceConnected())); connect(websocket_.get(), SIGNAL(Disconnected()), SLOT(OnServiceDisconnected())); connect(websocket_.get(), SIGNAL(ConnectingFailed()), SLOT(OnServiceConnectingFailed())); connect(websocket_.get(), SIGNAL(Message(CloudRenderingProtocol::MessageSharedPtr)), SLOT(OnServiceMessage(CloudRenderingProtocol::MessageSharedPtr))); // Connect to service serviceHost_ = WebRTC::WebSocketClient::CleanHost(plugin_->GetFramework()->CommandLineParameters("--cloudRenderer").first()); if (!serviceHost_.isEmpty()) websocket_->Connect(serviceHost_); else LogError(LC + "--cloudRenderer <cloudRenderingServiceHost> parameter not defined, cannot connect to service for renderer registration!"); }
bool CCBListener::ReadMsgFromCCB() { if( !m_sock ) { return false; } m_sock->timeout(CCB_TIMEOUT); ClassAd msg; if( !msg.initFromStream( *m_sock ) || !m_sock->end_of_message() ) { dprintf(D_ALWAYS, "CCBListener: failed to receive message from CCB server %s\n", m_ccb_address.Value()); Disconnected(); return false; } m_last_contact_from_peer = time(NULL); RescheduleHeartbeat(); int cmd = -1; msg.LookupInteger( ATTR_COMMAND, cmd ); switch( cmd ) { case CCB_REGISTER: return HandleCCBRegistrationReply( msg ); case CCB_REQUEST: return HandleCCBRequest( msg ); case ALIVE: dprintf(D_FULLDEBUG,"CCBListener: received heartbeat from server.\n"); return true; } MyString msg_str; msg.sPrint(msg_str); dprintf( D_ALWAYS, "CCBListener: Unexpected message received from CCB " "server: %s\n", msg_str.Value() ); return false; }
LegacyAudioConsumer::~LegacyAudioConsumer() { if ( mInitStatus != B_OK ) { return; } /* Clean up */ if ( mConnected ) { Disconnected( mInput.source, mInput.destination ); } if ( mRunning ) { HandleStop(); } if ( io_buf1 != NULL ) { free( static_cast<void *>(const_cast<audio_buffer_header *>(io_buf1)) ); } if ( fd != 0 ) { close( fd ); } }