This commit is contained in:
niko
2026-04-12 16:51:38 +02:00
parent 1b6f6d81d0
commit c12fbe3fc6
17828 changed files with 2994770 additions and 0 deletions
@@ -0,0 +1,895 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading;
using BestHTTP.Extensions;
using BestHTTP.Logger;
using BestHTTP.WebSocket.Frames;
using Cpp2IlInjected;
namespace BestHTTP.WebSocket
{
// Token: 0x020019AA RID: 6570
[Token(Token = "0x20019AA")]
public sealed class WebSocketResponse : HTTPResponse, IHeartbeat, IProtocol
{
// Token: 0x17001850 RID: 6224
// (get) Token: 0x060098F2 RID: 39154 RVA: 0x001F3CBC File Offset: 0x001F1EBC
// (set) Token: 0x060098F3 RID: 39155 RVA: 0x001F3CD0 File Offset: 0x001F1ED0
[Token(Token = "0x17001850")]
public WebSocket WebSocket
{
[Token(Token = "0x60098F2")]
[Address(RVA = "0x44C890", Offset = "0x44B890", VA = "0x18044C890")]
get;
[Token(Token = "0x60098F3")]
[Address(RVA = "0x44E020", Offset = "0x44D020", VA = "0x18044E020")]
internal set;
}
// Token: 0x17001851 RID: 6225
// (get) Token: 0x060098F4 RID: 39156 RVA: 0x001F3CE4 File Offset: 0x001F1EE4
[Token(Token = "0x17001851")]
public bool IsClosed
{
[Token(Token = "0x60098F4")]
[Address(RVA = "0x638310", Offset = "0x637310", VA = "0x180638310", Slot = "7")]
get
{
return this.closed;
}
}
// Token: 0x17001852 RID: 6226
// (get) Token: 0x060098F5 RID: 39157 RVA: 0x001F3CF8 File Offset: 0x001F1EF8
// (set) Token: 0x060098F6 RID: 39158 RVA: 0x001F3D0C File Offset: 0x001F1F0C
[Token(Token = "0x17001852")]
public TimeSpan PingFrequnecy
{
[Token(Token = "0x60098F5")]
[Address(RVA = "0x44BF00", Offset = "0x44AF00", VA = "0x18044BF00")]
get;
[Token(Token = "0x60098F6")]
[Address(RVA = "0x42DB80", Offset = "0x42CB80", VA = "0x18042DB80")]
private set;
}
// Token: 0x17001853 RID: 6227
// (get) Token: 0x060098F7 RID: 39159 RVA: 0x001F3D20 File Offset: 0x001F1F20
// (set) Token: 0x060098F8 RID: 39160 RVA: 0x001F3D34 File Offset: 0x001F1F34
[Token(Token = "0x17001853")]
public ushort MaxFragmentSize
{
[Token(Token = "0x60098F7")]
[Address(RVA = "0x638330", Offset = "0x637330", VA = "0x180638330")]
get;
[Token(Token = "0x60098F8")]
[Address(RVA = "0x638340", Offset = "0x637340", VA = "0x180638340")]
private set;
}
// Token: 0x17001854 RID: 6228
// (get) Token: 0x060098F9 RID: 39161 RVA: 0x001F3D48 File Offset: 0x001F1F48
[Token(Token = "0x17001854")]
public int BufferedAmount
{
[Token(Token = "0x60098F9")]
[Address(RVA = "0x5BF050", Offset = "0x5BE050", VA = "0x1805BF050")]
get
{
return this._bufferedAmount;
}
}
// Token: 0x17001855 RID: 6229
// (get) Token: 0x060098FA RID: 39162 RVA: 0x001F3D5C File Offset: 0x001F1F5C
// (set) Token: 0x060098FB RID: 39163 RVA: 0x001F3D70 File Offset: 0x001F1F70
[Token(Token = "0x17001855")]
public int Latency
{
[Token(Token = "0x60098FA")]
[Address(RVA = "0x5BF060", Offset = "0x5BE060", VA = "0x1805BF060")]
get;
[Token(Token = "0x60098FB")]
[Address(RVA = "0x5BF280", Offset = "0x5BE280", VA = "0x1805BF280")]
private set;
}
// Token: 0x060098FC RID: 39164 RVA: 0x001F3D84 File Offset: 0x001F1F84
[Token(Token = "0x60098FC")]
[Address(RVA = "0x6380D0", Offset = "0x6370D0", VA = "0x1806380D0")]
internal WebSocketResponse(HTTPRequest request, Stream stream, bool isStreamed, bool isFromCache)
{
List<WebSocketFrameReader> list = new List();
this.IncompleteFrames = list;
List<WebSocketFrameReader> list2 = new List();
this.CompletedFrames = list2;
List<WebSocketFrameReader> list3 = new List();
this.frameCache = list3;
object obj = new object();
this.FrameLock = obj;
object obj2 = new object();
this.SendLock = obj2;
List<WebSocketFrame> list4 = new List();
this.unsentFrames = list4;
int num;
AutoResetEvent autoResetEvent = new AutoResetEvent(num != 0);
num = 0;
this.newFrameSignal = autoResetEvent;
DateTime minValue = DateTime.MinValue;
this.lastPing = minValue;
DateTime minValue2 = DateTime.MinValue;
this.lastMessage = minValue2;
CircularBuffer<int> circularBuffer = new CircularBuffer(WebSocketResponse.RTTBufferCapacity);
this.rtts = circularBuffer;
this.<IsClosedManually>k__BackingField = true;
this.MaxFragmentSize = (ushort)((uint)32767);
this.closed = false;
}
// Token: 0x060098FD RID: 39165 RVA: 0x001F3E44 File Offset: 0x001F2044
[Token(Token = "0x60098FD")]
[Address(RVA = "0x638020", Offset = "0x637020", VA = "0x180638020")]
internal void StartReceive()
{
bool flag = ThreadPool.QueueUserWorkItem(new WaitCallback(this.ReceiveThreadFunc));
}
// Token: 0x060098FE RID: 39166 RVA: 0x001F3E64 File Offset: 0x001F2064
[Token(Token = "0x60098FE")]
[Address(RVA = "0x635A60", Offset = "0x634A60", VA = "0x180635A60")]
internal void CloseStream()
{
ConnectionBase connectionWith = HTTPManager.GetConnectionWith(this.baseRequest);
if (connectionWith != 0)
{
connectionWith.Abort((HTTPConnectionStates)((uint)9));
return;
}
}
// Token: 0x060098FF RID: 39167 RVA: 0x001F3E8C File Offset: 0x001F208C
[Token(Token = "0x60098FF")]
[Address(RVA = "0x637B50", Offset = "0x636B50", VA = "0x180637B50")]
public void Send(string message)
{
int num;
WebSocketFrame webSocketFrame;
do
{
num = 0;
if (message == 0)
{
goto IL_A2;
}
object obj = Encoding.UTF8.Clone();
byte[] bytes = Encoding.UTF8.GetBytes(message);
byte[] <Data>k__BackingField = webSocketFrame.<Data>k__BackingField;
if (<Data>k__BackingField == 0)
{
goto IL_99;
}
ushort num2 = this.<MaxFragmentSize>k__BackingField;
if (<Data>k__BackingField.Length <= (int)num2)
{
goto IL_99;
}
WebSocketFrame[] array = webSocketFrame.Fragment(num2);
object sendLock = this.SendLock;
this.Send(webSocketFrame);
if (array != 0 && num < array.Length)
{
WebSocketFrame webSocketFrame2 = array[num];
this.Send(webSocketFrame2);
num++;
}
Monitor.Exit(sendLock);
}
while (num != 0);
if (num != -1)
{
}
IL_99:
this.Send(webSocketFrame);
return;
IL_A2:
ArgumentNullException ex = new ArgumentNullException("message must not be null!");
throw new IndexOutOfRangeException();
}
// Token: 0x06009900 RID: 39168 RVA: 0x001F3F4C File Offset: 0x001F214C
[Token(Token = "0x6009900")]
[Address(RVA = "0x637470", Offset = "0x636470", VA = "0x180637470")]
public void Send(byte[] data)
{
int num;
WebSocketFrame webSocketFrame;
do
{
num = 0;
if (data == 0)
{
goto IL_9D;
}
int length;
ulong num2;
ulong num3;
webSocketFrame = new WebSocketFrame(this.<WebSocket>k__BackingField, (WebSocketFrameTypes)((ulong)2L), data, (ulong)num, (ulong)length, num2 != 0UL, num3 != 0UL);
length = data.Length;
byte[] <Data>k__BackingField = webSocketFrame.<Data>k__BackingField;
if (<Data>k__BackingField == 0)
{
goto IL_95;
}
ushort num4 = this.<MaxFragmentSize>k__BackingField;
if (<Data>k__BackingField.Length <= (int)num4)
{
goto IL_95;
}
WebSocketFrame[] array = webSocketFrame.Fragment(num4);
object sendLock = this.SendLock;
this.Send(webSocketFrame);
if (array != 0 && num < array.Length)
{
WebSocketFrame webSocketFrame2 = array[num];
this.Send(webSocketFrame2);
num++;
}
Monitor.Exit(sendLock);
}
while (num != 0);
if (num != -1)
{
}
IL_95:
this.Send(webSocketFrame);
return;
IL_9D:
ArgumentNullException ex = new ArgumentNullException("data must not be null!");
throw new IndexOutOfRangeException();
}
// Token: 0x06009901 RID: 39169 RVA: 0x001F4008 File Offset: 0x001F2208
[Token(Token = "0x6009901")]
[Address(RVA = "0x637690", Offset = "0x636690", VA = "0x180637690")]
public void Send(byte[] data, ulong offset, ulong count)
{
int num;
WebSocketFrame webSocketFrame;
do
{
num = 0;
if (data == 0)
{
goto IL_85;
}
int length = data.Length;
byte[] <Data>k__BackingField = webSocketFrame.<Data>k__BackingField;
if (<Data>k__BackingField == 0)
{
goto IL_7D;
}
ushort num2 = this.<MaxFragmentSize>k__BackingField;
if (<Data>k__BackingField.Length <= (int)num2)
{
goto IL_7D;
}
WebSocketFrame[] array = webSocketFrame.Fragment(num2);
object sendLock = this.SendLock;
this.Send(webSocketFrame);
if (array != 0 && num < array.Length)
{
WebSocketFrame webSocketFrame2 = array[num];
this.Send(webSocketFrame2);
num++;
}
Monitor.Exit(sendLock);
}
while (num != 0);
if (num != -1)
{
}
IL_7D:
this.Send(webSocketFrame);
return;
IL_85:
ArgumentNullException ex = new ArgumentNullException("data must not be null!");
throw new IndexOutOfRangeException();
}
// Token: 0x06009902 RID: 39170 RVA: 0x001F40AC File Offset: 0x001F22AC
[Token(Token = "0x6009902")]
[Address(RVA = "0x637900", Offset = "0x636900", VA = "0x180637900")]
public void Send(WebSocketFrame frame)
{
int num;
do
{
num = 0;
if (frame == 0)
{
goto IL_7C;
}
if (this.closed || this.closeSent)
{
return;
}
object sendLock = this.SendLock;
this.unsentFrames.Add(frame);
if (!this.sendThreadCreated)
{
ILogger logger = HTTPManager.Logger;
bool flag = ThreadPool.QueueUserWorkItem(new WaitCallback(this.SendThreadFunc));
this.sendThreadCreated = true;
}
Monitor.Exit(sendLock);
}
while (num != 0);
if (frame.<Data>k__BackingField != (ulong)0L)
{
}
bool flag2 = this.newFrameSignal.Set();
return;
IL_7C:
ArgumentNullException ex = new ArgumentNullException("frame is null!");
throw new NullReferenceException();
}
// Token: 0x06009903 RID: 39171 RVA: 0x001F414C File Offset: 0x001F234C
[Token(Token = "0x6009903")]
[Address(RVA = "0x635E70", Offset = "0x634E70", VA = "0x180635E70")]
public void Insert(WebSocketFrame frame)
{
int num;
do
{
num = 0;
if (frame == 0)
{
goto IL_83;
}
if (this.closed || this.closeSent)
{
return;
}
object sendLock = this.SendLock;
List<WebSocketFrame> list = this.unsentFrames;
int num2 = 0;
list.Insert(num2, frame);
if (!this.sendThreadCreated)
{
ILogger logger = HTTPManager.Logger;
bool flag = ThreadPool.QueueUserWorkItem(new WaitCallback(this.SendThreadFunc));
this.sendThreadCreated = true;
}
Monitor.Exit(sendLock);
}
while (num != 0);
if (frame.<Data>k__BackingField != (ulong)0L)
{
}
bool flag2 = this.newFrameSignal.Set();
return;
IL_83:
ArgumentNullException ex = new ArgumentNullException("frame is null!");
throw new NullReferenceException();
}
// Token: 0x06009904 RID: 39172 RVA: 0x001F41F4 File Offset: 0x001F23F4
[Token(Token = "0x6009904")]
[Address(RVA = "0x636B20", Offset = "0x635B20", VA = "0x180636B20")]
public void SendNow(WebSocketFrame frame)
{
/*
An exception occurred when decompiling this method (06009904)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.WebSocket.WebSocketResponse::SendNow(BestHTTP.WebSocket.Frames.WebSocketFrame)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_3C:
stloc:ArgumentNullException(var_4_46, newobj:ArgumentNullException(ArgumentNullException::.ctor, ldstr:string("frame is null!")))
}
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: 0x06009905 RID: 39173 RVA: 0x001F4248 File Offset: 0x001F2448
[Token(Token = "0x6009905")]
[Address(RVA = "0x635E30", Offset = "0x634E30", VA = "0x180635E30")]
public void Close()
{
}
// Token: 0x06009906 RID: 39174 RVA: 0x001F4258 File Offset: 0x001F2458
[Token(Token = "0x6009906")]
[Address(RVA = "0x635C90", Offset = "0x634C90", VA = "0x180635C90")]
public void Close(ushort code, string msg)
{
int num;
do
{
num = 0;
if (this.closed)
{
return;
}
object sendLock = this.SendLock;
this.unsentFrames.Clear();
Monitor.Exit(sendLock);
}
while (num != 0);
WebSocket webSocket = this.<WebSocket>k__BackingField;
byte[] array = WebSocket.EncodeCloseData(code, msg);
ulong num2;
int num3;
ulong num4;
ulong num5;
WebSocketFrame webSocketFrame = new WebSocketFrame(webSocket, (WebSocketFrameTypes)((ulong)8L), array, num2, (ulong)num3, num4 != 0UL, num5 != 0UL);
if (array != 0)
{
}
num3 = 0;
this.Send(webSocketFrame);
}
// Token: 0x06009907 RID: 39175 RVA: 0x001F42D0 File Offset: 0x001F24D0
[Token(Token = "0x6009907")]
[Address(RVA = "0x637E50", Offset = "0x636E50", VA = "0x180637E50")]
public void StartPinging(int frequency)
{
Delegate @delegate;
int num;
do
{
TimeSpan timeSpan;
this.<PingFrequnecy>k__BackingField = timeSpan;
DateTime utcNow = DateTime.UtcNow;
this.lastMessage = utcNow;
this.SendPing();
HTTPManager.Heartbeats.Subscribe(this);
Action<bool> onApplicationForegroundStateChanged = HTTPUpdateDelegator.OnApplicationForegroundStateChanged;
Action<bool> action = new Action(this.OnApplicationForegroundStateChanged);
@delegate = Delegate.Combine(onApplicationForegroundStateChanged, action);
num = 0;
}
while (@delegate != 0 && @delegate == 0);
HTTPUpdateDelegator.OnApplicationForegroundStateChanged = num;
}
// Token: 0x06009908 RID: 39176 RVA: 0x001F4348 File Offset: 0x001F2548
[Token(Token = "0x6009908")]
[Address(RVA = "0x636EB0", Offset = "0x635EB0", VA = "0x180636EB0")]
private void SendThreadFunc(object param)
{
int num;
do
{
num = 0;
List<WebSocketFrame> list = new List();
if (!this.closed && !this.closeSent)
{
AutoResetEvent autoResetEvent = this.newFrameSignal;
object sendLock = this.SendLock;
int size = this.unsentFrames._size;
List<WebSocketFrame> list2 = this.unsentFrames;
list.Clear();
Monitor.Exit(sendLock);
if (num != 0)
{
goto IL_118;
}
if ((ulong)((uint)(-1)) != (ulong)(-1L))
{
}
int size2 = list._size;
list.RemoveAt(size2);
if (!this.closeSent)
{
int num2 = this.Stream.ReadByte();
if (num != 0)
{
goto IL_11E;
}
if ((ulong)((uint)(-1)) != (ulong)(-1L))
{
}
this.closeSent = true;
}
Stream stream = this.Stream;
HTTPRequest baseRequest = this.baseRequest;
baseRequest.<State>k__BackingField = (HTTPRequestStates)((ulong)5L);
this.baseRequest.<Exception>k__BackingField = baseRequest;
this.baseRequest.<State>k__BackingField = (HTTPRequestStates)((ulong)4L);
this.closed = true;
}
this.sendThreadCreated = false;
AutoResetEvent autoResetEvent2 = this.newFrameSignal;
this.newFrameSignal = (ulong)0L;
ILogger logger = HTTPManager.Logger;
}
while (num != 0);
return;
IL_118:
throw new NullReferenceException();
IL_11E:
throw new NullReferenceException();
}
// Token: 0x06009909 RID: 39177 RVA: 0x001F44A8 File Offset: 0x001F26A8
[Token(Token = "0x6009909")]
[Address(RVA = "0x636130", Offset = "0x635130", VA = "0x180636130")]
private void ReceiveThreadFunc(object param)
{
for (;;)
{
int num = 0;
ReadOnlyBufferedStream readOnlyBufferedStream = new ReadOnlyBufferedStream(this.Stream);
int num2 = 0;
uint num3;
if (!this.closed)
{
DateTime utcNow = DateTime.UtcNow;
this.lastMessage = utcNow;
if (utcNow > (ulong)10L)
{
goto IL_69;
}
if (this.OnIncompleteFrame == (ulong)0L)
{
goto IL_8C;
}
object frameLock = this.FrameLock;
List<WebSocketFrameReader> completedFrames = this.CompletedFrames;
num3 += (uint)1;
Monitor.Exit(frameLock);
if (num != 0)
{
goto IL_247;
}
if (num3 != (uint)(-1))
{
goto IL_69;
}
IL_9F:
WebSocket webSocket = this.<WebSocket>k__BackingField;
object frameLock2 = this.FrameLock;
List<WebSocketFrameReader> completedFrames2 = this.CompletedFrames;
num3 += (uint)1;
Monitor.Exit(frameLock2);
if (num != 0)
{
goto IL_253;
}
if (num3 != (uint)(-1))
{
}
if (this.closeSent || this.closed)
{
continue;
}
WebSocketFrame webSocketFrame;
if (!this.closeSent)
{
this.Send(webSocketFrame);
}
this.closed = true;
this.Send(webSocketFrame);
long num4;
num4 -= num4;
TimeSpan timeSpan = TimeSpan.FromTicks(num4);
CircularBuffer<int> circularBuffer = this.rtts;
int num5 = 0;
circularBuffer.Add(num5);
int num6 = this.CalculateLatency();
this.<Latency>k__BackingField = num6;
int num7 = 0;
Monitor.Exit(circularBuffer);
if (num != 0)
{
goto IL_26B;
}
if (num3 != (uint)(-1))
{
}
IL_154:
this.IncompleteFrames.Add(num7);
uint num8;
this.Close((ushort)num8, "Protocol Error: masked frame received from server!");
this.IncompleteFrames.Clear();
this.baseRequest.<State>k__BackingField = (HTTPRequestStates)((ulong)5L);
this.closed = true;
HTTPRequest baseRequest;
if (!this.newFrameSignal.Set())
{
baseRequest = this.baseRequest;
baseRequest.<State>k__BackingField = (HTTPRequestStates)((ulong)5L);
}
this.baseRequest.<Exception>k__BackingField = baseRequest;
this.baseRequest.<State>k__BackingField = (HTTPRequestStates)((ulong)4L);
this.closed = true;
AutoResetEvent autoResetEvent = this.newFrameSignal;
goto IL_1D8;
IL_69:
if (this.OnIncompleteFrame == (ulong)0L)
{
goto IL_154;
}
object frameLock3 = this.FrameLock;
List<WebSocketFrameReader> completedFrames3 = this.CompletedFrames;
num3 += (uint)1;
IL_8C:
List<WebSocketFrameReader> incompleteFrames = this.IncompleteFrames;
this.IncompleteFrames.Clear();
goto IL_9F;
}
IL_1D8:
num3 += (uint)1;
if (num2 != 0)
{
}
if (num == 0)
{
if (num3 != (uint)(-1))
{
}
HTTPManager.Heartbeats.Unsubscribe(this);
Action<bool> onApplicationForegroundStateChanged = HTTPUpdateDelegator.OnApplicationForegroundStateChanged;
Action<bool> action = new Action(this.OnApplicationForegroundStateChanged);
Delegate @delegate = Delegate.Remove(onApplicationForegroundStateChanged, action);
if (@delegate == 0 || @delegate != 0)
{
HTTPUpdateDelegator.OnApplicationForegroundStateChanged = @delegate;
ILogger logger = HTTPManager.Logger;
if (num == 0)
{
break;
}
}
}
}
return;
IL_247:
throw new NullReferenceException();
IL_253:
throw new NullReferenceException();
IL_26B:
throw new NullReferenceException();
}
// Token: 0x0600990A RID: 39178 RVA: 0x0000220F File Offset: 0x0000040F
[Token(Token = "0x600990A")]
[Address(RVA = "0x635480", Offset = "0x634480", VA = "0x180635480", Slot = "8")]
void IProtocol.HandleEvents()
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
// Token: 0x0600990B RID: 39179 RVA: 0x001F4750 File Offset: 0x001F2950
[Token(Token = "0x600990B")]
[Address(RVA = "0x6350D0", Offset = "0x6340D0", VA = "0x1806350D0", Slot = "6")]
void IHeartbeat.OnHeartbeatUpdate(TimeSpan dif)
{
DateTime utcNow = DateTime.UtcNow;
DateTime dateTime = this.lastPing;
TimeSpan timeSpan = utcNow - dateTime;
TimeSpan timeSpan2 = this.<PingFrequnecy>k__BackingField;
if (timeSpan >= timeSpan2)
{
this.SendPing();
}
DateTime dateTime2 = this.lastMessage;
TimeSpan timeSpan3 = this.<PingFrequnecy>k__BackingField;
DateTime dateTime3 = dateTime2 + timeSpan3;
TimeSpan timeSpan4 = utcNow - dateTime3;
TimeSpan <CloseAfterNoMesssage>k__BackingField = this.<WebSocket>k__BackingField.<CloseAfterNoMesssage>k__BackingField;
if (timeSpan4 > <CloseAfterNoMesssage>k__BackingField)
{
ILogger logger = HTTPManager.Logger;
object[] array = new object[4];
DateTime dateTime4 = this.lastMessage;
if (array != 0)
{
}
array[0] = array;
TimeSpan timeSpan5 = this.<PingFrequnecy>k__BackingField;
if (timeSpan5 != 0)
{
}
array[1] = timeSpan5;
TimeSpan <CloseAfterNoMesssage>k__BackingField2 = this.<WebSocket>k__BackingField.<CloseAfterNoMesssage>k__BackingField;
if (<CloseAfterNoMesssage>k__BackingField2 != 0)
{
}
array[2] = <CloseAfterNoMesssage>k__BackingField2;
if (<CloseAfterNoMesssage>k__BackingField2 != 0)
{
}
array[3] = <CloseAfterNoMesssage>k__BackingField2;
string text = string.Format("No message received in the given time! Closing WebSocket. LastMessage: {0}, PingFrequency: {1}, Close After: {2}, Now: {3}", array);
this.CloseWithError("No message received in the given time!");
}
}
// Token: 0x0600990C RID: 39180 RVA: 0x001F4858 File Offset: 0x001F2A58
[Token(Token = "0x600990C")]
[Address(RVA = "0x6360C0", Offset = "0x6350C0", VA = "0x1806360C0")]
private void OnApplicationForegroundStateChanged(bool isPaused)
{
if (!isPaused)
{
DateTime utcNow = DateTime.UtcNow;
this.lastMessage = utcNow;
}
}
// Token: 0x0600990D RID: 39181 RVA: 0x001F4878 File Offset: 0x001F2A78
[Token(Token = "0x600990D")]
[Address(RVA = "0x636CD0", Offset = "0x635CD0", VA = "0x180636CD0")]
private void SendPing()
{
DateTime utcNow = DateTime.UtcNow;
this.lastPing = utcNow;
DateTime utcNow2 = DateTime.UtcNow;
byte[] array;
ulong num;
int num2;
ulong num3;
ulong num4;
WebSocketFrame webSocketFrame = new WebSocketFrame(this.<WebSocket>k__BackingField, (WebSocketFrameTypes)((ulong)9L), array, num, (ulong)num2, num3 != 0UL, num4 != 0UL);
if (array != 0)
{
}
num2 = 0;
this.Insert(webSocketFrame);
ILogger logger = HTTPManager.Logger;
}
// Token: 0x0600990E RID: 39182 RVA: 0x001F48E0 File Offset: 0x001F2AE0
[Token(Token = "0x600990E")]
[Address(RVA = "0x635AE0", Offset = "0x634AE0", VA = "0x180635AE0")]
private void CloseWithError(string message)
{
Delegate @delegate;
int num;
do
{
HTTPRequest baseRequest = this.baseRequest;
Exception ex = new Exception(message);
baseRequest.<Exception>k__BackingField = ex;
this.baseRequest.<State>k__BackingField = (HTTPRequestStates)((ulong)4L);
this.closed = true;
HTTPManager.Heartbeats.Unsubscribe(this);
Action<bool> onApplicationForegroundStateChanged = HTTPUpdateDelegator.OnApplicationForegroundStateChanged;
Action<bool> action = new Action(this.OnApplicationForegroundStateChanged);
@delegate = Delegate.Remove(onApplicationForegroundStateChanged, action);
num = 0;
}
while (@delegate != 0 && @delegate == 0);
HTTPUpdateDelegator.OnApplicationForegroundStateChanged = num;
bool flag = this.newFrameSignal.Set();
this.CloseStream();
}
// Token: 0x0600990F RID: 39183 RVA: 0x001F4970 File Offset: 0x001F2B70
[Token(Token = "0x600990F")]
[Address(RVA = "0x6359A0", Offset = "0x6349A0", VA = "0x1806359A0")]
private int CalculateLatency()
{
CircularBuffer<int> circularBuffer = this.rtts;
int num = 0;
int num2 = circularBuffer[num];
num += num2;
num++;
CircularBuffer<int> circularBuffer2 = this.rtts;
return num;
}
// Token: 0x04006769 RID: 26473
[Token(Token = "0x4006769")]
public static int RTTBufferCapacity;
// Token: 0x0400676B RID: 26475
[FieldOffset(Offset = "0xE0")]
[Token(Token = "0x400676B")]
public Action<WebSocketResponse, string> OnText;
// Token: 0x0400676C RID: 26476
[FieldOffset(Offset = "0xE8")]
[Token(Token = "0x400676C")]
public Action<WebSocketResponse, byte[]> OnBinary;
// Token: 0x0400676D RID: 26477
[FieldOffset(Offset = "0xF0")]
[Token(Token = "0x400676D")]
public Action<WebSocketResponse, WebSocketFrameReader> OnIncompleteFrame;
// Token: 0x0400676E RID: 26478
[FieldOffset(Offset = "0xF8")]
[Token(Token = "0x400676E")]
public Action<WebSocketResponse, ushort, string> OnClosed;
// Token: 0x04006771 RID: 26481
[FieldOffset(Offset = "0x10C")]
[Token(Token = "0x4006771")]
private int _bufferedAmount;
// Token: 0x04006773 RID: 26483
[FieldOffset(Offset = "0x118")]
[Token(Token = "0x4006773")]
private List<WebSocketFrameReader> IncompleteFrames;
// Token: 0x04006774 RID: 26484
[FieldOffset(Offset = "0x120")]
[Token(Token = "0x4006774")]
private List<WebSocketFrameReader> CompletedFrames;
// Token: 0x04006775 RID: 26485
[FieldOffset(Offset = "0x128")]
[Token(Token = "0x4006775")]
private List<WebSocketFrameReader> frameCache;
// Token: 0x04006776 RID: 26486
[FieldOffset(Offset = "0x130")]
[Token(Token = "0x4006776")]
private WebSocketFrameReader CloseFrame;
// Token: 0x04006777 RID: 26487
[FieldOffset(Offset = "0x150")]
[Token(Token = "0x4006777")]
private object FrameLock;
// Token: 0x04006778 RID: 26488
[FieldOffset(Offset = "0x158")]
[Token(Token = "0x4006778")]
private object SendLock;
// Token: 0x04006779 RID: 26489
[FieldOffset(Offset = "0x160")]
[Token(Token = "0x4006779")]
private List<WebSocketFrame> unsentFrames;
// Token: 0x0400677A RID: 26490
[FieldOffset(Offset = "0x168")]
[Token(Token = "0x400677A")]
private AutoResetEvent newFrameSignal;
// Token: 0x0400677B RID: 26491
[FieldOffset(Offset = "0x170")]
[Token(Token = "0x400677B")]
private bool sendThreadCreated;
// Token: 0x0400677C RID: 26492
[FieldOffset(Offset = "0x171")]
[Token(Token = "0x400677C")]
private bool closeSent;
// Token: 0x0400677D RID: 26493
[FieldOffset(Offset = "0x172")]
[Token(Token = "0x400677D")]
private bool closed;
// Token: 0x0400677E RID: 26494
[FieldOffset(Offset = "0x178")]
[Token(Token = "0x400677E")]
private DateTime lastPing;
// Token: 0x0400677F RID: 26495
[FieldOffset(Offset = "0x180")]
[Token(Token = "0x400677F")]
private DateTime lastMessage;
// Token: 0x04006780 RID: 26496
[FieldOffset(Offset = "0x188")]
[Token(Token = "0x4006780")]
private CircularBuffer<int> rtts;
}
}