コード例 #1
0
ファイル: Connection.cpp プロジェクト: ASchurman/Dissent
 void Connection::HandleEdgeClose()
 {
   Edge *edge = qobject_cast<Edge *>(sender());
   if(edge == _edge.data()) {
     emit Disconnected(edge->GetStoppedReason());
   }
 }
コード例 #2
0
  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();
    }
  }