protected internal override void RxRecived(Packet.Rx reciver) { if (reciver.Prefix.TransferNumber == 0) ServiceSend(BaseConnection.Statistic, reciver.Prefix.TransferID); else if (reciver.Prefix.TransferNumber == 1) { Hop hop = new Hop() {Description = BaseConnection.LocalHost.Info}; hop.OpenedConnections = new ObservableCollection<Hop>(Tcp.LocalOpenedConnections.Select(c => new Hop() {Description = c.RemoteHost.Info, RemoteID = c.ID, Statistic = c.Statistic})); ServiceSend(hop, reciver.Prefix.TransferID); } else if (reciver.Prefix.TransferNumber == 2) { int cid = (int)reciver.DataFrame; Tcp.Connection connection = Tcp.LocalOpenedConnections.FirstOrDefault(x=>x.ID == cid); if (connection == null) { ServiceSend(new ConnectionCloseResultArgs() {IsFaulted = true, Exception = new KeyNotFoundException("Die angegebne Connection konnte nicht gefunden werden: [" + cid + "]")}, reciver.Prefix.TransferID); } else { connection.Close(); ServiceSend(new ConnectionCloseResultArgs(), reciver.Prefix.TransferID); } } }
protected internal override void ReleaseResources() { Hop = null; Statistic = null; }
public Task<Hop> ReloadHopInformation() { Request<Hop> r = new Request<Hop>(this); r.Options.TimeOut = TimeSpan.FromSeconds(5); return r.Send(null, 1).ContinueWith(t => { Hop = t.Result; HopReloadTime = DateTime.Now; return t.Result; }, Tcp.UiScheduler); }