Example #1
0
  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");
    }
  }