BUGFIX: deadlock

This commit is contained in:
Sarah Jamie Lewis 2018-05-09 13:48:41 -07:00
parent 6f9718596d
commit 417d25dc7c
1 changed files with 2 additions and 0 deletions

View File

@ -70,10 +70,12 @@ func (cm *ChannelManager) OpenChannelRequestFromPeer(channelID int32, chandler c
cm.lock.Lock()
_, exists := cm.channels[channelID]
if exists {
cm.lock.Unlock()
return nil, utils.ChannelIDIsAlreadyInUseError
}
cm.lock.Unlock()
// Some channels only allow us to open one of them per connection
if chandler.Singleton() && cm.Channel(chandler.Type(), channels.Inbound) != nil {
return nil, utils.AttemptToOpenMoreThanOneSingletonChannelError