private void HandleDataWritten(IAsyncResult ar) { try { _stream.EndWrite(ar); _keepAliveTracker.OnDataSent(); } catch (Exception ex) { try { HandleSendOperationException(ex); } catch (Exception innnerException) { _log(innnerException.Message); } } }
private void HandleDataWritten(IAsyncResult ar) { try { _stream.EndWrite(ar); _keepAliveTracker.OnDataSent(); } catch (Exception ex) { if (!CloseIfShould(ex)) { throw; } } }
private async Task SendFrame(byte[] frame) { if (frame == null) { throw new ArgumentNullException("frame"); } if (State != WebSocketState.Open) { throw new InvalidOperationException("This websocket session has not connected."); } try { await _stream.WriteAsync(frame, 0, frame.Length); _keepAliveTracker.OnDataSent(); } catch (Exception ex) when(!ShouldThrow(ex)) { } }