public void HandleEdgeSend(Edge from, ICopyable p) {
SimulationEdge se_from = (SimulationEdge)from;
if(!Nat.Outgoing(se_from.RemoteTA)) {
return;
}
if(_ploss_prob > 0) {
if(_rand.NextDouble() < _ploss_prob) {
return;
}
}
MemBlock mb = p as MemBlock;
if(mb == null) {
int offset = p.CopyTo(_ba.Buffer, _ba.Offset);
mb = MemBlock.Reference(_ba.Buffer, _ba.Offset, offset);
_ba.AdvanceBuffer(offset);
_bytes += offset;
}
SimulationEdge se_to = se_from.Partner;
if(se_to == null) {
return;
}
if(!se_to.SimEL.Nat.Incoming(se_from.LocalTA)) {
return;
}
se_to.Push(mb);
}
}