Exemple #1
0
ConnectionPtr Connection::create( ConnectionDescriptionPtr description )
{
    ConnectionPtr connection;
    switch( description->type )
    {
        case CONNECTIONTYPE_TCPIP:
        case CONNECTIONTYPE_SDP:
            connection = new SocketConnection( description->type );
            break;

        case CONNECTIONTYPE_PIPE:
            connection = new PipeConnection;
            break;

#ifdef _WIN32
        case CONNECTIONTYPE_NAMEDPIPE:
            connection = new NamedPipeConnection;
            break;
#endif

#ifdef EQ_INFINIBAND
        case CONNECTIONTYPE_IB:
            connection = new IBConnection;
            break;
#endif
        case CONNECTIONTYPE_RSP:
            connection = new RSPConnection;
            break;

#ifdef CO_USE_OFED
        case CONNECTIONTYPE_RDMA:
            connection = new RDMAConnection;
            break;
#endif
#ifdef CO_USE_UDT
        case CONNECTIONTYPE_UDT:
            connection = new UDTConnection;
            break;
#endif

        default:
            LBWARN << "Connection type " << description->type
                   << " not supported" << std::endl;
            return 0;
    }

    if( description->bandwidth == 0 )
        description->bandwidth = connection->getDescription()->bandwidth;

    connection->_setDescription( description );
    return connection;
}