public void HandleData(MemBlock data, ISender return_path, object state) { /* * Write the messages: */ Console.WriteLine("Msg from: {0}", return_path); data.ToMemoryStream().WriteTo( System.Console.OpenStandardOutput() ); Console.WriteLine(); return_path.Send( new CopyList(PType.Protocol.Chat, MemBlock.Null) ); }
/** * Handle periodic synchronization messages for edge maintenance. * @param remoteid remote id for the edge. * @param localid local id for the edge. * @param rest_of_payload control message. */ protected void HandleEdgeSync(int remoteid, int localid, MemBlock rest_of_payload) { #if TUNNEL_DEBUG Console.Error.WriteLine("Receiving edge control"); #endif TunnelEdge tun_edge = null; lock( _sync ) { tun_edge = GetTunnelEdge(localid, remoteid); } if (tun_edge != null) { ArrayList arg; ArrayList forwarders = new ArrayList(); using(MemoryStream payload_ms = rest_of_payload.ToMemoryStream()) { arg = (ArrayList) AdrConverter.Deserialize(payload_ms); //list of forwarders for (int i = 0; i < arg.Count; i++) { forwarders.Add(AddressParser.Parse(MemBlock.Reference((byte[]) arg[i]))); } } tun_edge.HandleSyncPacket(forwarders); } }