PauseConnections
Namespace: SynicSugar.P2P
Class: ConnectHub
public async UniTask PauseConnections(bool isForced = false, CancellationTokenSource cancelToken = default(CancellationTokenSource))
Description
Stop receiving packets to the receive buffer and getting a packet from there.
After call this, the packets will have been dropped until connection will re-open.
To getting restart, call RestartConnections.
If 1st is false, get all packets in current buffer, then stop receiving.
If true, stop receiving a packet to the buffer immediatly.
2nd token is just for this Task instead of PacketReceiver's.
using SynicSugar.P2P;
using Cysharp.Threading.Tasks;
public class p2pSample {
void ConnectHubSample(){
ConnectHub.Instance.PauseConnections().Forget();
}
}