private IEnumerable<object> WriteNextFrame(Action<IFrameWriter> writer, Func<IFrameReader, IEnumerable<object>> reader, byte streamId) { // acquire the global lock to write the request lock (_globalLock) { ThrowClientRequestAbortedIfConnectionFailed(); _logger.Debug("Starting writing frame for stream {0}@{1}", streamId, Endpoint); using (FrameWriter frameWriter = new FrameWriter(_outputStream, streamId)) writer(frameWriter); _logger.Debug("Done writing frame for stream {0}@{1}", streamId, Endpoint); } // return a promise to stream results return StreamResultsThenReleaseStreamId(reader, streamId); }
private void WriteNextFrame(Action<IFrameWriter> writer, byte streamId) { // acquire the global lock to write the request _logger.Debug("Starting writing frame for stream {0}@{1}", streamId, Endpoint); lock (_globalLock) { using (FrameWriter frameWriter = new FrameWriter(_outputStream, streamId)) writer(frameWriter); } _logger.Debug("Done writing frame for stream {0}@{1}", streamId, Endpoint); }