782 lines
31 KiB
C#
782 lines
31 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Net;
|
|
using System.Net.Sockets;
|
|
using System.Threading;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.PlatformSupport.TcpClient.General
|
|
{
|
|
// Token: 0x02002054 RID: 8276
|
|
[Token(Token = "0x2002054")]
|
|
public class TcpClient : IDisposable
|
|
{
|
|
// Token: 0x0600CF85 RID: 53125 RVA: 0x002F3538 File Offset: 0x002F1738
|
|
[Token(Token = "0x600CF85")]
|
|
[Address(RVA = "0x22A4B40", Offset = "0x22A3B40", VA = "0x1822A4B40")]
|
|
private void Init(AddressFamily family)
|
|
{
|
|
Socket socket = this.client;
|
|
this.active = false;
|
|
if (socket != 0)
|
|
{
|
|
socket.Close();
|
|
this.client = (ulong)0L;
|
|
}
|
|
Socket socket2;
|
|
this.client = socket2;
|
|
}
|
|
|
|
// Token: 0x0600CF86 RID: 53126 RVA: 0x002F3570 File Offset: 0x002F1770
|
|
[Token(Token = "0x600CF86")]
|
|
[Address(RVA = "0x22A4F70", Offset = "0x22A3F70", VA = "0x1822A4F70")]
|
|
public TcpClient()
|
|
{
|
|
this.Init(AddressFamily.InterNetwork);
|
|
TimeSpan timeSpan;
|
|
this.ConnectTimeout = timeSpan;
|
|
}
|
|
|
|
// Token: 0x0600CF87 RID: 53127 RVA: 0x002F3594 File Offset: 0x002F1794
|
|
[Token(Token = "0x600CF87")]
|
|
[Address(RVA = "0x22A4EB0", Offset = "0x22A3EB0", VA = "0x1822A4EB0")]
|
|
public TcpClient(AddressFamily family)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600CF87)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.PlatformSupport.TcpClient.General.TcpClient::.ctor(System.Net.Sockets.AddressFamily)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_19:
|
|
stloc:ArgumentException(var_2_28, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("Family must be InterNetwork or InterNetworkV6"), ldstr:string("family")))
|
|
}
|
|
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
|
|
--- End of inner exception stack trace ---
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
|
|
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600CF88 RID: 53128 RVA: 0x002F35CC File Offset: 0x002F17CC
|
|
[Token(Token = "0x600CF88")]
|
|
[Address(RVA = "0x22A4FF0", Offset = "0x22A3FF0", VA = "0x1822A4FF0")]
|
|
public TcpClient(IPEndPoint localEP)
|
|
{
|
|
string text = localEP.ToString();
|
|
TimeSpan timeSpan;
|
|
this.ConnectTimeout = timeSpan;
|
|
}
|
|
|
|
// Token: 0x0600CF89 RID: 53129 RVA: 0x002F35F4 File Offset: 0x002F17F4
|
|
[Token(Token = "0x600CF89")]
|
|
[Address(RVA = "0x22A5090", Offset = "0x22A4090", VA = "0x1822A5090")]
|
|
public TcpClient(string hostname, int port)
|
|
{
|
|
TimeSpan timeSpan;
|
|
this.ConnectTimeout = timeSpan;
|
|
this.Connect(hostname, port);
|
|
}
|
|
|
|
// Token: 0x170020F8 RID: 8440
|
|
// (get) Token: 0x0600CF8A RID: 53130 RVA: 0x002F3618 File Offset: 0x002F1818
|
|
// (set) Token: 0x0600CF8B RID: 53131 RVA: 0x002F362C File Offset: 0x002F182C
|
|
[Token(Token = "0x170020F8")]
|
|
protected bool Active
|
|
{
|
|
[Token(Token = "0x600CF8A")]
|
|
[Address(RVA = "0x497570", Offset = "0x496570", VA = "0x180497570")]
|
|
get
|
|
{
|
|
return this.active;
|
|
}
|
|
[Token(Token = "0x600CF8B")]
|
|
[Address(RVA = "0x611070", Offset = "0x610070", VA = "0x180611070")]
|
|
set
|
|
{
|
|
this.active = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170020F9 RID: 8441
|
|
// (get) Token: 0x0600CF8C RID: 53132 RVA: 0x002F3640 File Offset: 0x002F1840
|
|
// (set) Token: 0x0600CF8D RID: 53133 RVA: 0x002F3654 File Offset: 0x002F1854
|
|
[Token(Token = "0x170020F9")]
|
|
public Socket Client
|
|
{
|
|
[Token(Token = "0x600CF8C")]
|
|
[Address(RVA = "0x4157C0", Offset = "0x4147C0", VA = "0x1804157C0")]
|
|
get
|
|
{
|
|
return this.client;
|
|
}
|
|
[Token(Token = "0x600CF8D")]
|
|
[Address(RVA = "0x22A4E30", Offset = "0x22A3E30", VA = "0x1822A4E30")]
|
|
set
|
|
{
|
|
this.client = value;
|
|
this.stream = (ulong)0L;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170020FA RID: 8442
|
|
// (get) Token: 0x0600CF8E RID: 53134 RVA: 0x002F3674 File Offset: 0x002F1874
|
|
[Token(Token = "0x170020FA")]
|
|
public int Available
|
|
{
|
|
[Token(Token = "0x600CF8E")]
|
|
[Address(RVA = "0x22A5120", Offset = "0x22A4120", VA = "0x1822A5120")]
|
|
get
|
|
{
|
|
return this.client.Available;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170020FB RID: 8443
|
|
// (get) Token: 0x0600CF8F RID: 53135 RVA: 0x002F3694 File Offset: 0x002F1894
|
|
[Token(Token = "0x170020FB")]
|
|
public bool Connected
|
|
{
|
|
[Token(Token = "0x600CF8F")]
|
|
[Address(RVA = "0x22A5140", Offset = "0x22A4140", VA = "0x1822A5140")]
|
|
get
|
|
{
|
|
return this.client.is_connected;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600CF90 RID: 53136 RVA: 0x002F36B4 File Offset: 0x002F18B4
|
|
[Token(Token = "0x600CF90")]
|
|
[Address(RVA = "0x22A4BD0", Offset = "0x22A3BD0", VA = "0x1822A4BD0")]
|
|
public bool IsConnected()
|
|
{
|
|
Socket socket = this.client;
|
|
int num = 0;
|
|
if (socket.Poll(1, (SelectMode)num))
|
|
{
|
|
int available = this.client.Available;
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x170020FC RID: 8444
|
|
// (get) Token: 0x0600CF91 RID: 53137 RVA: 0x002F36F0 File Offset: 0x002F18F0
|
|
// (set) Token: 0x0600CF92 RID: 53138 RVA: 0x002F3710 File Offset: 0x002F1910
|
|
[Token(Token = "0x170020FC")]
|
|
public bool ExclusiveAddressUse
|
|
{
|
|
[Token(Token = "0x600CF91")]
|
|
[Address(RVA = "0x22A5160", Offset = "0x22A4160", VA = "0x1822A5160")]
|
|
get
|
|
{
|
|
return this.client.ExclusiveAddressUse;
|
|
}
|
|
[Token(Token = "0x600CF92")]
|
|
[Address(RVA = "0x22A5500", Offset = "0x22A4500", VA = "0x1822A5500")]
|
|
set
|
|
{
|
|
this.client.ExclusiveAddressUse = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600CF93 RID: 53139 RVA: 0x002F3730 File Offset: 0x002F1930
|
|
[Token(Token = "0x600CF93")]
|
|
[Address(RVA = "0x22A4E30", Offset = "0x22A3E30", VA = "0x1822A4E30")]
|
|
internal void SetTcpClient(Socket s)
|
|
{
|
|
this.client = s;
|
|
this.stream = (ulong)0L;
|
|
}
|
|
|
|
// Token: 0x170020FD RID: 8445
|
|
// (get) Token: 0x0600CF94 RID: 53140 RVA: 0x002F3750 File Offset: 0x002F1950
|
|
// (set) Token: 0x0600CF95 RID: 53141 RVA: 0x002F3790 File Offset: 0x002F1990
|
|
[Token(Token = "0x170020FD")]
|
|
public LingerOption LingerState
|
|
{
|
|
[Token(Token = "0x600CF94")]
|
|
[Address(RVA = "0x22A5180", Offset = "0x22A4180", VA = "0x1822A5180")]
|
|
get
|
|
{
|
|
while (this.values == (TcpClient.Properties)1)
|
|
{
|
|
object socketOption = this.client.GetSocketOption((SocketOptionLevel)((uint)65535), (SocketOptionName)((uint)128));
|
|
if (socketOption == 0)
|
|
{
|
|
}
|
|
if (socketOption != 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
return this.linger_state;
|
|
}
|
|
[Token(Token = "0x600CF95")]
|
|
[Address(RVA = "0x22A5520", Offset = "0x22A4520", VA = "0x1822A5520")]
|
|
set
|
|
{
|
|
Socket socket = this.client;
|
|
if (socket.is_connected)
|
|
{
|
|
socket.SetSocketOption((SocketOptionLevel)((uint)65535), (SocketOptionName)((uint)128), value);
|
|
return;
|
|
}
|
|
this.linger_state = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170020FE RID: 8446
|
|
// (get) Token: 0x0600CF96 RID: 53142 RVA: 0x002F37D0 File Offset: 0x002F19D0
|
|
// (set) Token: 0x0600CF97 RID: 53143 RVA: 0x002F37FC File Offset: 0x002F19FC
|
|
[Token(Token = "0x170020FE")]
|
|
public bool NoDelay
|
|
{
|
|
[Token(Token = "0x600CF96")]
|
|
[Address(RVA = "0x22A5230", Offset = "0x22A4230", VA = "0x1822A5230")]
|
|
get
|
|
{
|
|
if (this.values == (TcpClient.Properties)2)
|
|
{
|
|
object socketOption = this.client.GetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.Debug);
|
|
}
|
|
return this.no_delay;
|
|
}
|
|
[Token(Token = "0x600CF97")]
|
|
[Address(RVA = "0x22A5570", Offset = "0x22A4570", VA = "0x1822A5570")]
|
|
set
|
|
{
|
|
if (this.client.is_connected)
|
|
{
|
|
return;
|
|
}
|
|
this.no_delay = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170020FF RID: 8447
|
|
// (get) Token: 0x0600CF98 RID: 53144 RVA: 0x002F3828 File Offset: 0x002F1A28
|
|
// (set) Token: 0x0600CF99 RID: 53145 RVA: 0x002F3860 File Offset: 0x002F1A60
|
|
[Token(Token = "0x170020FF")]
|
|
public int ReceiveBufferSize
|
|
{
|
|
[Token(Token = "0x600CF98")]
|
|
[Address(RVA = "0x22A52C0", Offset = "0x22A42C0", VA = "0x1822A52C0")]
|
|
get
|
|
{
|
|
if (this.values == (TcpClient.Properties)4)
|
|
{
|
|
object socketOption = this.client.GetSocketOption((SocketOptionLevel)((uint)65535), (SocketOptionName)((uint)4098));
|
|
}
|
|
return this.recv_buffer_size;
|
|
}
|
|
[Token(Token = "0x600CF99")]
|
|
[Address(RVA = "0x22A55C0", Offset = "0x22A45C0", VA = "0x1822A55C0")]
|
|
set
|
|
{
|
|
Socket socket = this.client;
|
|
if (socket.is_connected)
|
|
{
|
|
socket.SetSocketOption((SocketOptionLevel)((uint)65535), (SocketOptionName)((uint)4098), value);
|
|
return;
|
|
}
|
|
this.recv_buffer_size = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17002100 RID: 8448
|
|
// (get) Token: 0x0600CF9A RID: 53146 RVA: 0x002F38A0 File Offset: 0x002F1AA0
|
|
// (set) Token: 0x0600CF9B RID: 53147 RVA: 0x002F38D8 File Offset: 0x002F1AD8
|
|
[Token(Token = "0x17002100")]
|
|
public int ReceiveTimeout
|
|
{
|
|
[Token(Token = "0x600CF9A")]
|
|
[Address(RVA = "0x22A5350", Offset = "0x22A4350", VA = "0x1822A5350")]
|
|
get
|
|
{
|
|
if (this.values == (TcpClient.Properties)8)
|
|
{
|
|
object socketOption = this.client.GetSocketOption((SocketOptionLevel)((uint)65535), (SocketOptionName)((uint)4102));
|
|
}
|
|
return this.recv_timeout;
|
|
}
|
|
[Token(Token = "0x600CF9B")]
|
|
[Address(RVA = "0x22A5610", Offset = "0x22A4610", VA = "0x1822A5610")]
|
|
set
|
|
{
|
|
Socket socket = this.client;
|
|
if (socket.is_connected)
|
|
{
|
|
socket.SetSocketOption((SocketOptionLevel)((uint)65535), (SocketOptionName)((uint)4102), value);
|
|
return;
|
|
}
|
|
this.recv_timeout = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17002101 RID: 8449
|
|
// (get) Token: 0x0600CF9C RID: 53148 RVA: 0x002F3918 File Offset: 0x002F1B18
|
|
// (set) Token: 0x0600CF9D RID: 53149 RVA: 0x002F3950 File Offset: 0x002F1B50
|
|
[Token(Token = "0x17002101")]
|
|
public int SendBufferSize
|
|
{
|
|
[Token(Token = "0x600CF9C")]
|
|
[Address(RVA = "0x22A53E0", Offset = "0x22A43E0", VA = "0x1822A53E0")]
|
|
get
|
|
{
|
|
if (this.values == (TcpClient.Properties)16)
|
|
{
|
|
object socketOption = this.client.GetSocketOption((SocketOptionLevel)((uint)65535), (SocketOptionName)((uint)4097));
|
|
}
|
|
return this.send_buffer_size;
|
|
}
|
|
[Token(Token = "0x600CF9D")]
|
|
[Address(RVA = "0x22A5660", Offset = "0x22A4660", VA = "0x1822A5660")]
|
|
set
|
|
{
|
|
Socket socket = this.client;
|
|
if (socket.is_connected)
|
|
{
|
|
socket.SetSocketOption((SocketOptionLevel)((uint)65535), (SocketOptionName)((uint)4097), value);
|
|
return;
|
|
}
|
|
this.send_buffer_size = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17002102 RID: 8450
|
|
// (get) Token: 0x0600CF9E RID: 53150 RVA: 0x002F3990 File Offset: 0x002F1B90
|
|
// (set) Token: 0x0600CF9F RID: 53151 RVA: 0x002F39C8 File Offset: 0x002F1BC8
|
|
[Token(Token = "0x17002102")]
|
|
public int SendTimeout
|
|
{
|
|
[Token(Token = "0x600CF9E")]
|
|
[Address(RVA = "0x22A5470", Offset = "0x22A4470", VA = "0x1822A5470")]
|
|
get
|
|
{
|
|
if (this.values == (TcpClient.Properties)32)
|
|
{
|
|
object socketOption = this.client.GetSocketOption((SocketOptionLevel)((uint)65535), (SocketOptionName)((uint)4101));
|
|
}
|
|
return this.send_timeout;
|
|
}
|
|
[Token(Token = "0x600CF9F")]
|
|
[Address(RVA = "0x22A56B0", Offset = "0x22A46B0", VA = "0x1822A56B0")]
|
|
set
|
|
{
|
|
Socket socket = this.client;
|
|
if (socket.is_connected)
|
|
{
|
|
socket.SetSocketOption((SocketOptionLevel)((uint)65535), (SocketOptionName)((uint)4101), value);
|
|
return;
|
|
}
|
|
this.send_timeout = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17002103 RID: 8451
|
|
// (get) Token: 0x0600CFA0 RID: 53152 RVA: 0x002F3A08 File Offset: 0x002F1C08
|
|
// (set) Token: 0x0600CFA1 RID: 53153 RVA: 0x002F3A1C File Offset: 0x002F1C1C
|
|
[Token(Token = "0x17002103")]
|
|
public TimeSpan ConnectTimeout
|
|
{
|
|
[Token(Token = "0x600CFA0")]
|
|
[Address(RVA = "0x4936E0", Offset = "0x4926E0", VA = "0x1804936E0")]
|
|
get;
|
|
[Token(Token = "0x600CFA1")]
|
|
[Address(RVA = "0x55BCE0", Offset = "0x55ACE0", VA = "0x18055BCE0")]
|
|
set;
|
|
}
|
|
|
|
// Token: 0x0600CFA2 RID: 53154 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x600CFA2")]
|
|
[Address(RVA = "0x22A4090", Offset = "0x22A3090", VA = "0x1822A4090")]
|
|
public void Close()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x0600CFA3 RID: 53155 RVA: 0x002F3A30 File Offset: 0x002F1C30
|
|
[Token(Token = "0x600CFA3")]
|
|
[Address(RVA = "0x22A40D0", Offset = "0x22A30D0", VA = "0x1822A40D0")]
|
|
public void Connect(IPEndPoint remoteEP)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
TimeSpan timeSpan = this.<ConnectTimeout>k__BackingField;
|
|
TimeSpan zero = TimeSpan.Zero;
|
|
if (!(timeSpan > zero))
|
|
{
|
|
this.client.Connect(remoteEP);
|
|
this.active = true;
|
|
}
|
|
int num2;
|
|
ManualResetEvent manualResetEvent = new ManualResetEvent(num2 != 0);
|
|
num2 = 0;
|
|
ManualResetEvent mre = manualResetEvent;
|
|
Socket socket = this.client;
|
|
AsyncCallback asyncCallback = delegate(IAsyncResult res)
|
|
{
|
|
bool flag2 = mre.Set();
|
|
};
|
|
int num3 = 0;
|
|
IAsyncResult asyncResult = socket.BeginConnect(remoteEP, asyncCallback, num3);
|
|
ManualResetEvent mre2 = mre;
|
|
TimeSpan timeSpan2 = this.<ConnectTimeout>k__BackingField;
|
|
bool flag = mre2.WaitOne(timeSpan2);
|
|
this.active = flag;
|
|
if (!flag)
|
|
{
|
|
goto IL_B6;
|
|
}
|
|
this.client.EndConnect(asyncResult);
|
|
this.CheckDisposed();
|
|
}
|
|
while (num != 0);
|
|
return;
|
|
IL_B6:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600CFA4 RID: 53156 RVA: 0x002F3B1C File Offset: 0x002F1D1C
|
|
[Token(Token = "0x600CFA4")]
|
|
[Address(RVA = "0x22A4310", Offset = "0x22A3310", VA = "0x1822A4310")]
|
|
public void Connect(IPAddress address, int port)
|
|
{
|
|
IPEndPoint ipendPoint = new IPEndPoint(address, port);
|
|
this.Connect(ipendPoint);
|
|
}
|
|
|
|
// Token: 0x0600CFA5 RID: 53157 RVA: 0x002F3B38 File Offset: 0x002F1D38
|
|
[Token(Token = "0x600CFA5")]
|
|
[Address(RVA = "0x22A4C70", Offset = "0x22A3C70", VA = "0x1822A4C70")]
|
|
private void SetOptions()
|
|
{
|
|
TcpClient.Properties properties = this.values;
|
|
int num = 0;
|
|
this.values = (TcpClient.Properties)num;
|
|
if (properties != (TcpClient.Properties)1)
|
|
{
|
|
Socket socket = this.client;
|
|
if ((socket.is_connected ? 1 : 0) != num)
|
|
{
|
|
LingerOption lingerOption = this.linger_state;
|
|
socket.SetSocketOption((SocketOptionLevel)((uint)65535), (SocketOptionName)((uint)128), lingerOption);
|
|
}
|
|
this.values = (TcpClient.Properties)((ulong)1L);
|
|
}
|
|
if (properties != (TcpClient.Properties)2 && (this.client.is_connected ? 1 : 0) != num)
|
|
{
|
|
bool flag = (this.no_delay ? 1 : 0) != num;
|
|
}
|
|
if (properties != (TcpClient.Properties)4)
|
|
{
|
|
Socket socket2 = this.client;
|
|
if ((socket2.is_connected ? 1 : 0) != num)
|
|
{
|
|
int num2 = this.recv_buffer_size;
|
|
socket2.SetSocketOption((SocketOptionLevel)((uint)65535), (SocketOptionName)((uint)4098), num2);
|
|
}
|
|
}
|
|
if (properties != (TcpClient.Properties)8)
|
|
{
|
|
Socket socket3 = this.client;
|
|
if ((socket3.is_connected ? 1 : 0) != num)
|
|
{
|
|
int num3 = this.recv_timeout;
|
|
socket3.SetSocketOption((SocketOptionLevel)((uint)65535), (SocketOptionName)((uint)4102), num3);
|
|
}
|
|
}
|
|
if (properties != (TcpClient.Properties)16)
|
|
{
|
|
Socket socket4 = this.client;
|
|
if ((socket4.is_connected ? 1 : 0) != num)
|
|
{
|
|
int num4 = this.send_buffer_size;
|
|
socket4.SetSocketOption((SocketOptionLevel)((uint)65535), (SocketOptionName)((uint)4097), num4);
|
|
}
|
|
}
|
|
if (properties != (TcpClient.Properties)32)
|
|
{
|
|
Socket socket5 = this.client;
|
|
int num5 = this.send_timeout;
|
|
if ((socket5.is_connected ? 1 : 0) == num)
|
|
{
|
|
return;
|
|
}
|
|
socket5.SetSocketOption((SocketOptionLevel)((uint)65535), (SocketOptionName)((uint)4101), num5);
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600CFA6 RID: 53158 RVA: 0x002F3C88 File Offset: 0x002F1E88
|
|
[Token(Token = "0x600CFA6")]
|
|
[Address(RVA = "0x22A4390", Offset = "0x22A3390", VA = "0x1822A4390")]
|
|
public void Connect(string hostname, int port)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600CFA6)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.PlatformSupport.TcpClient.General.TcpClient::Connect(System.String,System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_A5:
|
|
stloc:TimeoutException(var_14_AF, newobj:TimeoutException(TimeoutException::.ctor, ldstr:string("DNS resolve timed out!")))
|
|
}
|
|
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
|
|
--- End of inner exception stack trace ---
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
|
|
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600CFA7 RID: 53159 RVA: 0x002F3D48 File Offset: 0x002F1F48
|
|
[Token(Token = "0x600CFA7")]
|
|
[Address(RVA = "0x22A4630", Offset = "0x22A3630", VA = "0x1822A4630")]
|
|
public void Connect(IPAddress[] ipAddresses, int port)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600CFA7)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.PlatformSupport.TcpClient.General.TcpClient::Connect(System.Net.IPAddress[],System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_D8:
|
|
stloc:ArgumentNullException(var_15_E2, newobj:ArgumentNullException(ArgumentNullException::.ctor, ldstr:string("ipAddresses")))
|
|
}
|
|
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
|
|
--- End of inner exception stack trace ---
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
|
|
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600CFA8 RID: 53160 RVA: 0x002F3E38 File Offset: 0x002F2038
|
|
[Token(Token = "0x600CFA8")]
|
|
[Address(RVA = "0x22A49D0", Offset = "0x22A39D0", VA = "0x1822A49D0")]
|
|
public void EndConnect(IAsyncResult asyncResult)
|
|
{
|
|
this.client.EndConnect(asyncResult);
|
|
}
|
|
|
|
// Token: 0x0600CFA9 RID: 53161 RVA: 0x002F3E58 File Offset: 0x002F2058
|
|
[Token(Token = "0x600CFA9")]
|
|
[Address(RVA = "0x22A3FA0", Offset = "0x22A2FA0", VA = "0x1822A3FA0")]
|
|
public IAsyncResult BeginConnect(IPAddress address, int port, AsyncCallback requestCallback, object state)
|
|
{
|
|
Socket socket = this.client;
|
|
IAsyncResult asyncResult;
|
|
return asyncResult;
|
|
}
|
|
|
|
// Token: 0x0600CFAA RID: 53162 RVA: 0x002F3E74 File Offset: 0x002F2074
|
|
[Token(Token = "0x600CFAA")]
|
|
[Address(RVA = "0x22A3F70", Offset = "0x22A2F70", VA = "0x1822A3F70")]
|
|
public IAsyncResult BeginConnect(IPAddress[] addresses, int port, AsyncCallback requestCallback, object state)
|
|
{
|
|
Socket socket = this.client;
|
|
IAsyncResult asyncResult;
|
|
return asyncResult;
|
|
}
|
|
|
|
// Token: 0x0600CFAB RID: 53163 RVA: 0x002F3E90 File Offset: 0x002F2090
|
|
[Token(Token = "0x600CFAB")]
|
|
[Address(RVA = "0x22A3FD0", Offset = "0x22A2FD0", VA = "0x1822A3FD0")]
|
|
public IAsyncResult BeginConnect(string host, int port, AsyncCallback requestCallback, object state)
|
|
{
|
|
Socket socket = this.client;
|
|
IAsyncResult asyncResult;
|
|
return asyncResult;
|
|
}
|
|
|
|
// Token: 0x0600CFAC RID: 53164 RVA: 0x002F3EAC File Offset: 0x002F20AC
|
|
[Token(Token = "0x600CFAC")]
|
|
[Address(RVA = "0x22A4E40", Offset = "0x22A3E40", VA = "0x1822A4E40", Slot = "4")]
|
|
void IDisposable.Dispose()
|
|
{
|
|
this.System.IDisposable.Dispose();
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
|
|
// Token: 0x0600CFAD RID: 53165 RVA: 0x002F3EC8 File Offset: 0x002F20C8
|
|
[Token(Token = "0x600CFAD")]
|
|
[Address(RVA = "0x22A4970", Offset = "0x22A3970", VA = "0x1822A4970", Slot = "5")]
|
|
protected virtual void Dispose(bool disposing)
|
|
{
|
|
if (!this.disposed)
|
|
{
|
|
this.disposed = true;
|
|
if (disposing)
|
|
{
|
|
NetworkStream networkStream = this.stream;
|
|
this.stream = (ulong)0L;
|
|
if (networkStream == 0)
|
|
{
|
|
Socket socket = this.client;
|
|
if (socket != 0)
|
|
{
|
|
socket.Close();
|
|
this.client = (ulong)0L;
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
int writeTimeout = networkStream.WriteTimeout;
|
|
this.active = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600CFAE RID: 53166 RVA: 0x002F3F28 File Offset: 0x002F2128
|
|
[Token(Token = "0x600CFAE")]
|
|
[Address(RVA = "0x22A49F0", Offset = "0x22A39F0", VA = "0x1822A49F0", Slot = "1")]
|
|
protected override void Finalize()
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
this.System.IDisposable.Dispose();
|
|
base..ctor();
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x0600CFAF RID: 53167 RVA: 0x002F3F48 File Offset: 0x002F2148
|
|
[Token(Token = "0x600CFAF")]
|
|
[Address(RVA = "0x22A4A70", Offset = "0x22A3A70", VA = "0x1822A4A70")]
|
|
public Stream GetStream()
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600CFAF)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.IO.Stream BestHTTP.PlatformSupport.TcpClient.General.TcpClient::GetStream()
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_1F:
|
|
call:void(TcpClient::CheckDisposed, ldloc:TcpClient(this))
|
|
brtrue(IL_00, cne:bool(ldloc:int32(var_0_01), ldc.i4:int32(0)))
|
|
}
|
|
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
|
|
--- End of inner exception stack trace ---
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
|
|
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600CFB0 RID: 53168 RVA: 0x002F3F80 File Offset: 0x002F2180
|
|
[Token(Token = "0x600CFB0")]
|
|
[Address(RVA = "0x22A4000", Offset = "0x22A3000", VA = "0x1822A4000")]
|
|
private void CheckDisposed()
|
|
{
|
|
}
|
|
|
|
// Token: 0x040083B0 RID: 33712
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40083B0")]
|
|
private NetworkStream stream;
|
|
|
|
// Token: 0x040083B1 RID: 33713
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40083B1")]
|
|
private bool active;
|
|
|
|
// Token: 0x040083B2 RID: 33714
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40083B2")]
|
|
private Socket client;
|
|
|
|
// Token: 0x040083B3 RID: 33715
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40083B3")]
|
|
private bool disposed;
|
|
|
|
// Token: 0x040083B4 RID: 33716
|
|
[FieldOffset(Offset = "0x2C")]
|
|
[Token(Token = "0x40083B4")]
|
|
private TcpClient.Properties values;
|
|
|
|
// Token: 0x040083B5 RID: 33717
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40083B5")]
|
|
private int recv_timeout;
|
|
|
|
// Token: 0x040083B6 RID: 33718
|
|
[FieldOffset(Offset = "0x34")]
|
|
[Token(Token = "0x40083B6")]
|
|
private int send_timeout;
|
|
|
|
// Token: 0x040083B7 RID: 33719
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x40083B7")]
|
|
private int recv_buffer_size;
|
|
|
|
// Token: 0x040083B8 RID: 33720
|
|
[FieldOffset(Offset = "0x3C")]
|
|
[Token(Token = "0x40083B8")]
|
|
private int send_buffer_size;
|
|
|
|
// Token: 0x040083B9 RID: 33721
|
|
[FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x40083B9")]
|
|
private LingerOption linger_state;
|
|
|
|
// Token: 0x040083BA RID: 33722
|
|
[FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x40083BA")]
|
|
private bool no_delay;
|
|
|
|
// Token: 0x02002055 RID: 8277
|
|
[Token(Token = "0x2002055")]
|
|
private enum Properties : uint
|
|
{
|
|
// Token: 0x040083BD RID: 33725
|
|
[Token(Token = "0x40083BD")]
|
|
LingerState = 1U,
|
|
// Token: 0x040083BE RID: 33726
|
|
[Token(Token = "0x40083BE")]
|
|
NoDelay,
|
|
// Token: 0x040083BF RID: 33727
|
|
[Token(Token = "0x40083BF")]
|
|
ReceiveBufferSize = 4U,
|
|
// Token: 0x040083C0 RID: 33728
|
|
[Token(Token = "0x40083C0")]
|
|
ReceiveTimeout = 8U,
|
|
// Token: 0x040083C1 RID: 33729
|
|
[Token(Token = "0x40083C1")]
|
|
SendBufferSize = 16U,
|
|
// Token: 0x040083C2 RID: 33730
|
|
[Token(Token = "0x40083C2")]
|
|
SendTimeout = 32U
|
|
}
|
|
}
|
|
}
|