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)) sinfo.bytesRecvd += uint64(len(bs))
select { select {
case sinfo.toConn <- bs: case sinfo.toConn <- bs:
case <-sinfo.cancel.Finished():
util.PutBytes(bs)
default: 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) util.PutBytes(bs)
} }
} }