private void CreateNewDeadClientFinalizer(string clientId, DateTime time) { DeadClientNotificationTask finalizer = new DeadClientNotificationTask(this, clientId, time); lock (syncRoot) _deadClientFinalizers.Add(clientId, finalizer); s_scheduler.AddTask(finalizer); }
private void ClientDisconnectedInternal(string clientId, Address node, DateTime disconnectTime) { ConnectedClient client; if (_connectedClients.TryGetValue(clientId, out client)) { if (client.RemoveNode(node) == 0) { _connectedClients.Remove(clientId); foreach (var notificationSpecification in _specifications) { if (!notificationSpecification.Value.ContainsKey(clientId)) { var task = new DeadClientNotificationTask(this, clientId, disconnectTime, notificationSpecification.Value, client.Info); notificationSpecification.Value.AddNotificationSpecificationTask(clientId, task); s_scheduler.AddTask(task); } } } } }
/// <summary> Add the given range [first_seqno, last_seqno] in the list of /// entries eligible for retransmission. If first_seqno > last_seqno, /// then the range [last_seqno, first_seqno] is added instead /// <p> /// If retransmitter thread is suspended, wake it up /// TODO: /// Does not check for duplicates ! /// </summary> public virtual void add(long first_seqno, long last_seqno) { RetransmitterEntry e; if (first_seqno > last_seqno) { long tmp = first_seqno; first_seqno = last_seqno; last_seqno = tmp; } lock (msgs.SyncRoot) { e = new RetransmitterEntry(this, first_seqno, last_seqno, RETRANSMIT_TIMEOUTS); msgs.Add(e); retransmitter.AddTask(e); } }
/// <summary> Adds a new message to the hash table. /// /// </summary> /// <param name="seqno">The sequence number associated with the message /// </param> /// <param name="msg">The message (should be a copy!) /// </param> /// <param name="receivers">The set of addresses to which the message was sent /// and from which consequently an ACK is expected /// </param> public virtual void add(long seqno, Message msg, System.Collections.ArrayList receivers) { Entry e; if (waiting) { return; } if (receivers.Count == 0) { return; } lock (msgs.SyncRoot) { if (msgs[(long)seqno] != null) { return; } e = new Entry(this, seqno, msg, receivers, retransmit_intervals); msgs[(long)seqno] = e; retransmitter.AddTask(e); } }