ssize_t TCPStream::receive(char* buffer, size_t len, int timeout) { if (timeout <= 0) return read(m_sd, buffer, len); if (waitForReadEvent(timeout) == true) { return read(m_sd, buffer, len); } return connectionTimedOut; }
MultiplexedConnections::ReplicaMap::iterator MultiplexedConnections::getReplicaForReading() { ReplicaMap::iterator it; if (supports_parallel_execution) it = waitForReadEvent(); else { it = replica_map.begin(); const ReplicaState & state = it->second; Connection * connection = connections[state.connection_index]; if (connection == nullptr) it = replica_map.end(); } return it; }