func (cm *ConnectionManager) RegisterProtocolHandler(id protocol.ID, maxPeers int, minPeers int) (*ProtocolHandler, error) {
	cm.protocolConfigurationLock.Lock()
	defer cm.protocolConfigurationLock.Unlock()
	if _, found := cm.protocolConfiguration[id]; found {
		return nil, fmt.Errorf("protocol handler for ID %s already exists", id)
	}

	handler := newProtocolHandler(cm.ctx, id, maxPeers, minPeers, cm.host, cm, cm.p2pDiscovery)

	cm.host.Notify(handler)

	cm.protocolConfiguration[id] = handler
	return cm.protocolConfiguration[id], nil
}
// RegisterProtocolHandler registers a protocol handler.
RegisterProtocolHandler registers a protocol handler.
// RegisterProtocolHandler registers a protocol handler .
func (cm *ConnectionManager) RegisterProtocolHandler(id protocol.ID, maxPeers int, minPeers int) (*ProtocolHandler, error) {
	cm.protocolConfigurationLock.Lock()
	defer cm.protocolConfigurationLock.Unlock()
	if _, found := cm.protocolConfiguration[id]; found {
		return nil, fmt.Errorf("protocol handler for ID %s already exists", id)
	}
	handler := newProtocolHandler(cm.ctx, id, maxPeers, minPeers, cm.host, cm, cm.p2pDiscovery)
	cm.host.Notify(handler)
	cm.protocolConfiguration[id] = handler
	return cm.protocolConfiguration[id], nil
}
func ( cm * ConnectionManager ) RegisterProtocolHandler ( id protocol . ID , maxPeers int , minPeers int ) ( * ProtocolHandler , error ) { cm . protocolConfigurationLock . Lock ( ) defer cm . protocolConfigurationLock . Unlock ( ) if _ , found := cm . protocolConfiguration [ id ] ; found { return nil , fmt . Errorf ( " " , id ) } handler := newProtocolHandler ( cm . ctx , id , maxPeers , minPeers , cm . host , cm , cm . p2pDiscovery ) cm . host . Notify ( handler ) cm . protocolConfiguration [ id ] = handler return cm . protocolConfiguration [ id ] , nil }
RegisterProtocolHandler registers a protocol handler.
RegisterProtocolHandler registers a protocol handler .