Logo Search packages:      
Sourcecode: kmess version File versions  Download package

void DirectConnectionPool::slotConnectionClosed (  )  [slot]

A direct connection was closed

Definition at line 294 of file directconnectionpool.cpp.

References hasPendingConnections().

Referenced by addConnection(), and addServerConnection().

{
  // Find out which object sent the signal
  const QObject *eventSender = sender();
  if(KMESS_NULL(eventSender)) return;
#ifdef KMESSTEST
  KMESS_ASSERT( eventSender->inherits("DirectConnectionBase") );
#endif

  // Remove the connection
  DirectConnectionBase *connection = static_cast<DirectConnectionBase*>(const_cast<QObject*>(eventSender));
  pendingConnections_.removeAll( connection );
  unauthorizedConnections_.removeAll( connection );

  // Signal when the active connection closed
  if(connection == activeConnection_)
  {
#ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL
    kDebug() << "Closed connection was the active connection!";
#endif

    emit activeConnectionClosed();
    activeConnection_ = 0;  // reset, will deleter later
  }
  else
  {
#ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL
    kDebug() << "Closed connection was another pending socket from the pool.";
#endif

    // Check whethere there is still a chance to get a direct connection
    if( activeConnection_ == 0 && ! hasPendingConnections() )
    {
#ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL
      kDebug() << "No remaining direct connections left.";
#endif

      // Emit signal for fallback (e.g. sending files over the switchboard)
      emit allConnectionsFailed();
    }
  }

  // delete the connection
  connection->blockSignals( true );
  connection->deleteLater();
}


Generated by  Doxygen 1.6.0   Back to index