Exemple #1
0
 void Session::HandleDisconnect()
 {
   Connection *con = qobject_cast<Connection *>(sender());
   if(!_group.Contains(con->GetRemoteId()) || Stopped()) {
     return;
   }
   qDebug() << "Closing Session due to disconnect";
   Stop();
 }
  void ConnectionManager::HandleDisconnect()
  {
    Connection *con = qobject_cast<Connection *>(sender());
    if(con == 0) {
      return;
    }

    qDebug() << "Handle disconnect on: " << con->ToString();
    _con_tab.Disconnect(con);

    if(!con->GetEdge()->Stopped()) {
      if(con->GetLocalId() != con->GetRemoteId()) {
        _rpc->SendNotification(con->GetSharedPointer(),
            "CM::Disconnect", QVariant());
      }

      con->GetEdge()->Stop("Local disconnect request");
    }
  }
  void ConnectionManager::HandleDisconnect()
  {
    Connection *con = qobject_cast<Connection *>(sender());
    if(con == 0) {
      return;
    }

    qDebug() << "Handle disconnect on: " << con->ToString();
    _con_tab.Disconnect(con);

    if(!con->GetEdge()->IsClosed()) {
      if(con->GetLocalId() != con->GetRemoteId()) {
        QVariantMap notification;
        notification["method"] = "CM::Disconnect";
        _rpc.SendNotification(notification, con);
      }

      con->GetEdge()->Close("Local disconnect request");
    }
  }
  void ConnectionManager::HandleEdgeClose(const QString &reason)
  {
    Edge *edge = qobject_cast<Edge *>(sender());
    qDebug() << "Edge closed: " << edge->ToString() << reason;
    if(!_con_tab.RemoveEdge(edge)) {
      qWarning() << "Edge closed but no Edge found in CT:" << edge->ToString();
    }

    Connection *con = _con_tab.GetConnection(edge);
    if(con != 0) {
      con = _con_tab.GetConnection(con->GetRemoteId());
      if(con != 0) {
        con->Disconnect();
      }
    }

    if(!_closed) {
      return;
    }

    if(_con_tab.GetEdges().count() == 0) {
      emit Disconnected();
    }
  }