From 417d25dc7cb0480a357be48f10e2d40e3f297c17 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 9 May 2018 13:48:41 -0700 Subject: [PATCH] BUGFIX: deadlock --- connection/channelmanager.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/connection/channelmanager.go b/connection/channelmanager.go index 6841c4f..3921e2c 100644 --- a/connection/channelmanager.go +++ b/connection/channelmanager.go @@ -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