Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
AuthenticatedStream.cs
Go to the documentation of this file.
1using System.IO;
3
4namespace System.Net.Security;
5
6public abstract class AuthenticatedStream : Stream
7{
8 private readonly Stream _innerStream;
9
10 private readonly bool _leaveStreamOpen;
11
13
15
16 public abstract bool IsAuthenticated { get; }
17
18 public abstract bool IsMutuallyAuthenticated { get; }
19
20 public abstract bool IsEncrypted { get; }
21
22 public abstract bool IsSigned { get; }
23
24 public abstract bool IsServer { get; }
25
26 protected AuthenticatedStream(Stream innerStream, bool leaveInnerStreamOpen)
27 {
28 if (innerStream == null || innerStream == Stream.Null)
29 {
30 throw new ArgumentNullException("innerStream");
31 }
32 if (!innerStream.CanRead || !innerStream.CanWrite)
33 {
34 throw new ArgumentException(System.SR.net_io_must_be_rw_stream, "innerStream");
35 }
36 _innerStream = innerStream;
37 _leaveStreamOpen = leaveInnerStreamOpen;
38 }
39
40 protected override void Dispose(bool disposing)
41 {
42 try
43 {
44 if (disposing)
45 {
47 {
49 }
50 else
51 {
53 }
54 }
55 }
56 finally
57 {
58 base.Dispose(disposing);
59 }
60 }
61
62 public override ValueTask DisposeAsync()
63 {
64 try
65 {
67 GC.SuppressFinalize(this);
68 return result;
69 }
70 catch (Exception exception)
71 {
73 }
74 }
75}
static void SuppressFinalize(object obj)
Definition GC.cs:202
Definition GC.cs:8
Task FlushAsync()
Definition Stream.cs:669
void Dispose()
Definition Stream.cs:639
static readonly Stream Null
Definition Stream.cs:488
virtual ValueTask DisposeAsync()
Definition Stream.cs:654
AuthenticatedStream(Stream innerStream, bool leaveInnerStreamOpen)
override void Dispose(bool disposing)
static string net_io_must_be_rw_stream
Definition SR.cs:26
Definition SR.cs:7
static ValueTask FromException(Exception exception)
Definition ValueTask.cs:190