void Slave_Connection_OnMessage(Slave_Connection SC, System.Xml.Linq.XElement xMsg) { // This event is called from an independent thread belonging to the particular slave. #if DEBUG // In the startup debugging phase, intercept anything and queue it for later. if (StartupDebugging) { lock (this) { DebugQueue.Enqueue(new Tuple <Slave_Connection, System.Xml.Linq.XElement>(SC, xMsg)); } return; } #endif Slave found = null; lock (Slaves) { foreach (Slave ss in Slaves) { if (ss.Connection == SC) { found = ss; break; } } } if (found != null) //lock (found) { Terminal.OnMessage(found, xMsg); return; } throw new Exception("Slave not found in current connections list."); }
public void Dispose() { if (Connection != null) { Connection.Dispose(); Connection = null; } GC.SuppressFinalize(true); }
Slave FindSlave(Slave_Connection With_Connection) { foreach (Slave ss in Slaves) { if (ss.Connection == With_Connection) { return(ss); } } return(null); }
private void Slave_Connection_OnState(Slave_Connection SC, Slave_Connection.Connection_State NewState) { lock (StateQueueLock) StateChanges.Enqueue(new Tuple <Slave_Connection, Slave_Connection.Connection_State>(SC, NewState)); }
public Slave(string HostName, RegistryCertificateStore AcceptedCertificates) { Connection = new Slave_Connection(HostName, AcceptedCertificates); lock (NextIDLock) { ID = NextID++; } DarkColor = DarkColors[ID % DarkColors.Length]; }