Example #1
0
 ConnectionVector CommunicationService::GetConnections(const QString &protocol) const
 {
     ConnectionVector connections;
     for (ConnectionVector::const_iterator i = connections_.begin(); i != connections_.end(); ++i)
     {
         ConnectionInterface* connection = *i;
         if ( connection->GetProtocol().compare( protocol ) == 0 )
             connections.push_back( connection );
     }
     return connections;
 }
// return connections for user belonging to current priority
ConnectionVector
ProportionalFair::getConnectionsForPrio(int currentPrio, const UserID user)
{
    ConnectionVector currentPrioConns;
    ConnectionVector allRegisteredConns = colleagues.registry->getConnectionsForUser(user);
    for (ConnectionVector::const_iterator iter = allRegisteredConns.begin();
         iter != allRegisteredConns.end();
         ++iter)
    {
        wns::scheduler::ConnectionID currentConnection = *iter;
        // check if the connection has the current priority
        if (colleagues.registry->getPriorityForConnection(currentConnection) == currentPrio)
        {
            if (colleagues.queue->queueHasPDUs(currentConnection))
            {
                currentPrioConns.push_back(currentConnection);
            }
            // else: this conection is empty, go to the next connection of this user
        }
        // else: this connection belongs to another, i.e. lower priority, go to the next connection of this user
    }
    return currentPrioConns;
}