コード例 #1
0
ファイル: Server.cpp プロジェクト: dbcfd/C11Http
void Server::broadcast(const char* byteStream, const unsigned int count)
        throw (std::runtime_error)
{
    std::vector<ServerConnection*>& conns = mConnections->getConnections();
    for (std::vector<ServerConnection*>::iterator iter = conns.begin();
            iter != conns.end(); ++iter)
    {
        send(byteStream, count, (*iter));
    }
    performWakeup();
}
コード例 #2
0
ファイル: Server.cpp プロジェクト: dbcfd/C11Http
void Server::send(const char* data, const unsigned int count,
        const std::string& identifier) throw (std::runtime_error)
{
    ServerConnection* connection = mConnections->getServerConnection(identifier);
    if (0 != connection)
    {
        send(data, count, connection);

    }
    else
    {
        std::stringstream sstr;
        sstr << "Connection not found: " << identifier;
        throw(std::runtime_error(sstr.str()));
    }
    performWakeup();

}
コード例 #3
0
ファイル: qatchat.cpp プロジェクト: Camelek/qtmoko
void QAtChat::prime()
{
    QAtChatCommand *cmd = d->first;

    // Bail out if there are no commands to be sent.
    if ( !cmd ) {
        return;
    }

    // Do we need to perform a wakeup on the device?
    if ( d->wakeupActive ) {
        if ( d->lastSendTime.elapsed() >= d->wakeupTime ) {
            performWakeup();
            return;
        }
        d->lastSendTime.restart();
    }

    // Write the command to the serial output stream.
    if ( !writeLine( cmd->d->command ) ) {
        // The command stream is not valid.  Fail the command.
        QTimer::singleShot( 0, this, SLOT(failCommand()) );
    }

    // Mark the command as primed.
    cmd->d->primed = true;

    // Reset the dead timer.
    if ( d->deadTimeout != -1 ) {
        d->deadTimer->start( d->deadTimeout );
    }

    // Reset the retry on non-echo timer, to detect the command echo.
    if ( d->retryOnNonEcho != -1 ) {
        d->retryTimer->start( d->retryOnNonEcho );
    }
}
コード例 #4
0
ファイル: Server.cpp プロジェクト: dbcfd/C11Http
void Server::shutdown()
{
    mHasBeenShutdown = true;
    mConnectSocket->closeSocket();
    performWakeup();
}