本文整理汇总了C#中MemBlock.ExtendHead方法的典型用法代码示例。如果您正苦于以下问题:C# MemBlock.ExtendHead方法的具体用法?C# MemBlock.ExtendHead怎么用?C# MemBlock.ExtendHead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemBlock
的用法示例。
在下文中一共展示了MemBlock.ExtendHead方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleData
/**
* Here we handle routing AHPackets
*/
public void HandleData(MemBlock data, ISender ret_path, object state) {
/*
* Unfortunately, the old code needs the full header intact, and
* we have already eaten a byte of it, put it back:
*/
MemBlock full_packet = data.ExtendHead(1);
AHPacket p = new AHPacket(full_packet);
//Route avoiding the edge we got the packet from:
IRouter router = null;
if( p.Destination.Class == 0 ) {
router = _ah_router;
}
else {
router = _d_router;
}
Edge edge_rec_from = ret_path as Edge;
bool deliver_locally;
router.Route(edge_rec_from, p, out deliver_locally);
if( deliver_locally ) {
//Send a response exactly back to the node that sent to us
ISender resp_send = new AHSender(_n, ret_path, p.Source,
_n.DefaultTTLFor(p.Source),
AHPacket.AHOptions.Exact);
//data:
_n.HandleData( data.Slice(AHPacket.HeaderLength), resp_send, this);
}
}