private void Controller_OnRelationshipRemoved(object sender, SchemaEventArgs <Connection> e) { Connection connection = e.Entity; connection.RemoveFromSurface(this); OnConnectionRemoved.RaiseEvent(this, new SchemaEventArgs <Connection>(connection)); }
public void Close(ProxyConnection connection) { if (ConnectionIndecies.TryRemove(connection, out var id)) { IndexConnections.TryRemove(id, out connection); OnConnectionRemoved?.Invoke(this, connection); DisposeConnection(connection); } }
public ControllerImpl() { Schema = new Schema(); Schema.OnConnectionAdded += (s, e) => OnConnectionAdded.RaiseEvent(this, e); Schema.OnConnectionRemoved += (s, e) => OnConnectionRemoved.RaiseEvent(this, e); Schema.OnShapeAdded += (s, e) => OnShapeAdded.RaiseEvent(this, e); Schema.OnShapeRemoved += (s, e) => OnShapeRemoved.RaiseEvent(this, e); Schema.OnSchemaCleared += (s, e) => OnSchemaCleared.RaiseEvent(this); }
public void Close(long id) { if (IndexConnections.TryRemove(id, out var connection)) { if (ConnectionIndecies.TryRemove(connection, out id)) { OnConnectionRemoved?.Invoke(this, connection); DisposeConnection(connection); } } }
protected void ProcessConnectionRemoved(Guid connectionId, VideoSource videoSource) { if (videoSource != null) { OnConnectionRemoved?.Invoke(connectionId, videoSource); } lock (_rtspList) { _rtspList.RemoveAll(c => c.Id == connectionId); } }
private void MonitorStreams() { while (IsRunning) { foreach (var client in Connections.ToList()) { if (!client.IsSocketConnected()) { var e5 = BuildEvent(client, null, String.Empty); Connections.Remove(client); OnConnectionRemoved?.Invoke(this, e5); continue; } if (client.Socket.Available != 0) { var readObject = ReadObject(client.Socket); var e1 = BuildEvent(client, null, readObject); OnPacketReceived?.Invoke(this, e1); if (readObject is PingPacket ping) { client.SendObject(ping).Wait(); continue; } if (readObject is PersonalPacket pp) { var destination = Connections.FirstOrDefault(c => c.ClientId.ToString() == pp.GuidId); var e4 = BuildEvent(client, destination, pp); OnPersonalPacketReceived?.Invoke(this, e4); if (destination != null) { destination.SendObject(pp).Wait(); var e2 = BuildEvent(client, destination, pp); OnPersonalPacketSent?.Invoke(this, e2); } } else { foreach (var c in Connections.ToList()) { c.SendObject(readObject).Wait(); var e3 = BuildEvent(client, c, readObject); OnPacketSent?.Invoke(this, e3); } } } } } }
internal void RemoveConnection(Connection connection) { _connections.Remove(connection.id); MarkDirty(); OnConnectionRemoved?.Invoke(connection); }