add defer to unlock

This commit is contained in:
Vladimir Stoilov 2022-09-20 17:00:08 +02:00 committed by Daniel
parent 6f56e62be4
commit 0085d6a7ea

View file

@ -221,8 +221,8 @@ func getConnection(pkt packet.Packet) (*network.Connection, error) {
// Else create new one from the packet.
conn = network.NewConnectionFromFirstPacket(pkt)
conn.Lock()
defer conn.Unlock()
conn.SetFirewallHandler(initialHandler)
conn.Unlock()
created = true
return conn, nil
})