Support InvalidSession(true)
This commit is contained in:
@@ -193,6 +193,12 @@ namespace Discord
|
||||
_reconnectCancelToken?.Cancel();
|
||||
Error(ex);
|
||||
}
|
||||
public void Reconnect()
|
||||
{
|
||||
_readyPromise.TrySetCanceled();
|
||||
_connectionPromise.TrySetCanceled();
|
||||
_connectionCancelToken?.Cancel();
|
||||
}
|
||||
private async Task AcquireConnectionLock()
|
||||
{
|
||||
while (true)
|
||||
|
||||
@@ -433,7 +433,11 @@ namespace Discord.WebSocket
|
||||
|
||||
_sessionId = null;
|
||||
_lastSeq = 0;
|
||||
await ApiClient.SendIdentifyAsync(shardID: ShardId, totalShards: TotalShards).ConfigureAwait(false);
|
||||
bool retry = (bool)payload;
|
||||
if (retry)
|
||||
_connection.Reconnect(); //TODO: Untested
|
||||
else
|
||||
await ApiClient.SendIdentifyAsync(shardID: ShardId, totalShards: TotalShards).ConfigureAwait(false);
|
||||
}
|
||||
break;
|
||||
case GatewayOpCode.Reconnect:
|
||||
|
||||
@@ -5,11 +5,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reactive.Concurrency;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Splat;
|
||||
using System.Reactive.Concurrency;
|
||||
|
||||
namespace Discord.Net
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user