Пример #1
0
 private async Task SafeWriteMessageAsync(ContentType type, byte[] buf, int offset, int len)
 {
     try
     {
         await rs.WriteMessageAsync(type, buf, offset, len);
     }
     catch (TlsFatalAlert e)
     {
         if (!this.closed)
         {
             this.FailWithError(AlertLevel.fatal, e.AlertDescription);
         }
         throw e;
     }
     catch (IOException e)
     {
         if (!closed)
         {
             this.FailWithError(AlertLevel.fatal, AlertDescription.internal_error);
         }
         throw e;
     }
     catch (Exception e)
     {
         if (!closed)
         {
             this.FailWithError(AlertLevel.fatal, AlertDescription.internal_error);
         }
         throw e;
     }
 }