5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-12-23 14:35:40 +00:00

explicitly consider the session finished case, and make a note that we could fix the packet drop situation by making the Conn into an actor too

This commit is contained in:
Arceliar 2019-08-23 22:36:59 -05:00
parent e3603c0462
commit cf9880464b

View File

@ -520,8 +520,12 @@ func (sinfo *sessionInfo) _recvPacket(p *wire_trafficPacket) {
sinfo.bytesRecvd += uint64(len(bs))
select {
case sinfo.toConn <- bs:
case <-sinfo.cancel.Finished():
util.PutBytes(bs)
default:
// We seem to have filled up the buffer in the mean time, so drop it
// We seem to have filled up the buffer in the mean time
// Since we need to not block, but the conn isn't an actor, we need to drop this packet
// TODO find some nicer way to interact with the Conn...
util.PutBytes(bs)
}
}