Struct Engine has methods on both value (#934)

Struct Engine has methods on both value and pointer receivers.
Such usage is not recommended by the Go Documentation.
This commit is contained in:
Zoltan Papp 2023-06-05 15:34:22 +02:00 committed by GitHub
parent 511f0a00be
commit dd69c1cd31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -793,14 +793,14 @@ func (e *Engine) connWorker(conn *peer.Conn, peerKey string) {
} }
} }
func (e Engine) peerExists(peerKey string) bool { func (e *Engine) peerExists(peerKey string) bool {
e.syncMsgMux.Lock() e.syncMsgMux.Lock()
defer e.syncMsgMux.Unlock() defer e.syncMsgMux.Unlock()
_, ok := e.peerConns[peerKey] _, ok := e.peerConns[peerKey]
return ok return ok
} }
func (e Engine) createPeerConn(pubKey string, allowedIPs string) (*peer.Conn, error) { func (e *Engine) createPeerConn(pubKey string, allowedIPs string) (*peer.Conn, error) {
log.Debugf("creating peer connection %s", pubKey) log.Debugf("creating peer connection %s", pubKey)
var stunTurn []*ice.URL var stunTurn []*ice.URL
stunTurn = append(stunTurn, e.STUNs...) stunTurn = append(stunTurn, e.STUNs...)