void OnSingletonConnection(IConnection connection, Action connectionDequeuedCallback, long streamPosition, int offset, int size, TimeSpan timeout) { if (onSingletonPreambleKnown == null) { onSingletonPreambleKnown = OnSingletonPreambleKnown; } ServerSingletonPreambleConnectionReader singletonPreambleReader = new ServerSingletonPreambleConnectionReader(connection, connectionDequeuedCallback, streamPosition, offset, size, transportSettingsCallback, onConnectionClosed, onSingletonPreambleKnown); lock (ThisLock) { if (isDisposed) { singletonPreambleReader.Dispose(); return; } connectionReaders.Add(singletonPreambleReader); } //TODO: This might block a thread. Work out if it's safe to make this method async void // or make the caller async. singletonPreambleReader.StartReadingAsync(viaDelegate, timeout).GetAwaiter().GetResult(); }
public ServerSingletonPreambleConnectionReader(IConnection connection, Action connectionDequeuedCallback, long streamPosition, int offset, int size, TransportSettingsCallback transportSettingsCallback, ConnectionClosedCallback closedCallback, ServerSingletonPreambleCallback callback) : base(connection, closedCallback) { this.decoder = new ServerSingletonDecoder(streamPosition, base.MaxViaSize, base.MaxContentTypeSize); this.offset = offset; this.size = size; this.callback = callback; this.transportSettingsCallback = transportSettingsCallback; this.rawConnection = connection; base.ConnectionDequeuedCallback = connectionDequeuedCallback; }
private void OnSingletonConnection(IConnection connection, Action connectionDequeuedCallback, long streamPosition, int offset, int size, TimeSpan timeout) { if (this.onSingletonPreambleKnown == null) { this.onSingletonPreambleKnown = new ServerSingletonPreambleCallback(this.OnSingletonPreambleKnown); } ServerSingletonPreambleConnectionReader item = new ServerSingletonPreambleConnectionReader(connection, connectionDequeuedCallback, streamPosition, offset, size, this.transportSettingsCallback, this.onConnectionClosed, this.onSingletonPreambleKnown); lock (this.ThisLock) { if (this.isDisposed) { item.Dispose(); return; } this.connectionReaders.Add(item); } item.StartReading(this.viaDelegate, timeout); }
void OnSingletonConnection(IConnection connection, Action connectionDequeuedCallback, long streamPosition, int offset, int size, TimeSpan timeout) { if (onSingletonPreambleKnown == null) { onSingletonPreambleKnown = OnSingletonPreambleKnown; } ServerSingletonPreambleConnectionReader singletonPreambleReader = new ServerSingletonPreambleConnectionReader(connection, connectionDequeuedCallback, streamPosition, offset, size, transportSettingsCallback, onConnectionClosed, onSingletonPreambleKnown); lock (ThisLock) { if (isDisposed) { singletonPreambleReader.Dispose(); return; } connectionReaders.Add(singletonPreambleReader); } singletonPreambleReader.StartReading(viaDelegate, timeout); }