com.puzzlescapegames.services 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,7 +4,6 @@ using System.Net;
|
|
|
4
4
|
using System.Net.Sockets;
|
|
5
5
|
using System.Threading;
|
|
6
6
|
using UnityEngine;
|
|
7
|
-
using Zenject;
|
|
8
7
|
|
|
9
8
|
namespace PuzzlescapeGames.Services.NTPService
|
|
10
9
|
{
|
|
@@ -31,7 +30,6 @@ namespace PuzzlescapeGames.Services.NTPService
|
|
|
31
30
|
private float _responseReceivedTime;
|
|
32
31
|
private byte[] _receivedNtpData;
|
|
33
32
|
private Socket _socket;
|
|
34
|
-
private Thread _syncThread;
|
|
35
33
|
private volatile bool _responseReceived;
|
|
36
34
|
private CancellationTokenSource _cancellationSource;
|
|
37
35
|
|
|
@@ -79,7 +77,6 @@ namespace PuzzlescapeGames.Services.NTPService
|
|
|
79
77
|
|
|
80
78
|
private void SynchronizeDate()
|
|
81
79
|
{
|
|
82
|
-
_syncThread?.Abort();
|
|
83
80
|
_socket?.Close();
|
|
84
81
|
|
|
85
82
|
_cancellationSource?.Cancel();
|
|
@@ -87,9 +84,8 @@ namespace PuzzlescapeGames.Services.NTPService
|
|
|
87
84
|
_cancellationSource = new();
|
|
88
85
|
|
|
89
86
|
_responseReceived = false;
|
|
90
|
-
_syncThread = new Thread( Request );
|
|
91
|
-
_syncThread.Start();
|
|
92
87
|
|
|
88
|
+
UniTask.RunOnThreadPool( Request, cancellationToken: _cancellationSource.Token ).Forget();
|
|
93
89
|
WaitForResponse( _cancellationSource.Token ).Forget();
|
|
94
90
|
|
|
95
91
|
Debug.Log( "[NTPDateTimeService] request started." );
|