Ejemplo n.º 1
0
void LogServerSink::logEvent(LogEvent event) {
    std::list<int>::iterator it;
    std::list<int>::iterator cur;
    int ok;

    for (it = m_connections.begin(); it != m_connections.end();) {
        cur = it;
        it++;

        ok = send(*cur, event.toFormattedString().c_str(),
                  event.toFormattedString().length(), 0);
        if (ok != (ssize_t)event.toFormattedString().length()) {
            close(*cur);
            m_connections.erase(cur);
        }
    }
}