4
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2025-07-16 03:48:55 +00:00

misc other fixes

This commit is contained in:
Arceliar
2019-09-18 18:33:51 -05:00
parent 2dc136f94a
commit 2d64a6380a
3 changed files with 11 additions and 15 deletions

View File

@ -416,8 +416,11 @@ func (sinfo *sessionInfo) _updateNonce(theirNonce *crypto.BoxNonce) {
// Called after coord changes, so attemtps to use a session will trigger a new ping and notify the remote end of the coord change.
// Only call this from the router actor.
func (ss *sessions) reset() {
for _, sinfo := range ss.sinfos {
sinfo.reset = true
for _, _sinfo := range ss.sinfos {
sinfo := _sinfo // So we can safely put it in a closure
sinfo.Act(ss.router, func() {
sinfo.reset = true
})
}
}
@ -474,12 +477,6 @@ func (sinfo *sessionInfo) _recvPacket(p *wire_trafficPacket) {
util.PutBytes(bs)
return
}
if sinfo.conn == nil {
// There's no connection associated with this session for some reason
// TODO: Figure out why this happens sometimes, it shouldn't
util.PutBytes(bs)
return
}
sinfo._updateNonce(&p.Nonce)
sinfo.bytesRecvd += uint64(len(bs))
sinfo.conn.recvMsg(sinfo, bs)