mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
add a newConn function that returns a pointer to a Conn with atomics properly initialized
This commit is contained in:
parent
75130f7735
commit
0059baf36c
4 changed files with 30 additions and 28 deletions
|
@ -456,14 +456,7 @@ func (ss *sessions) handlePing(ping *sessionPing) {
|
|||
// Check and see if there's a Listener waiting to accept connections
|
||||
// TODO: this should not block if nothing is accepting
|
||||
if !ping.IsPong && ss.listener != nil {
|
||||
conn := &Conn{
|
||||
core: ss.core,
|
||||
session: sinfo,
|
||||
mutex: &sync.RWMutex{},
|
||||
nodeID: crypto.GetNodeID(&sinfo.theirPermPub),
|
||||
nodeMask: &crypto.NodeID{},
|
||||
searchwait: make(chan interface{}),
|
||||
}
|
||||
conn := newConn(ss.core, crypto.GetNodeID(&sinfo.theirPermPub), &crypto.NodeID{}, sinfo)
|
||||
for i := range conn.nodeMask {
|
||||
conn.nodeMask[i] = 0xFF
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue