@@ -25,13 +25,13 @@ internal static class ClientNetworkStatus
25
25
26
26
public static IPubnubLog PubnubLog { get ; set ; }
27
27
28
- internal static async Task < bool > CheckInternetStatus < T > ( bool systemActive , PNOperationType type , PNCallback < T > callback , string [ ] channels , string [ ] channelGroups )
28
+ internal static bool CheckInternetStatus < T > ( bool systemActive , PNOperationType type , PNCallback < T > callback , string [ ] channels , string [ ] channelGroups )
29
29
{
30
30
if ( unit != null ) {
31
31
return unit . InternetAvailable ;
32
32
} else {
33
33
try {
34
- await CheckClientNetworkAvailability ( CallbackClientNetworkStatus , type , callback , channels , channelGroups ) . ConfigureAwait ( false ) ;
34
+ return CheckClientNetworkAvailability ( CallbackClientNetworkStatus , type , callback , channels , channelGroups ) ;
35
35
} catch ( AggregateException ae ) {
36
36
foreach ( var ie in ae . InnerExceptions ) {
37
37
LoggingMethod . WriteToLog ( pubnubLog , string . Format ( CultureInfo . InvariantCulture , "DateTime {0} AggregateException CheckInternetStatus Error: {1} {2} " , DateTime . Now . ToString ( CultureInfo . InvariantCulture ) , ie . GetType ( ) . Name , ie . Message ) , pubnubConfig . LogVerbosity ) ;
@@ -57,7 +57,7 @@ internal static bool IsInternetCheckRunning()
57
57
return isInternetCheckRunning ;
58
58
}
59
59
60
- private static async Task < bool > CheckClientNetworkAvailability < T > ( Action < bool > internalCallback , PNOperationType type , PNCallback < T > callback , string [ ] channels , string [ ] channelGroups )
60
+ private static bool CheckClientNetworkAvailability < T > ( Action < bool > internalCallback , PNOperationType type , PNCallback < T > callback , string [ ] channels , string [ ] channelGroups )
61
61
{
62
62
lock ( internetCheckLock ) {
63
63
if ( isInternetCheckRunning ) {
@@ -75,7 +75,7 @@ private static async Task<bool> CheckClientNetworkAvailability<T>(Action<bool> i
75
75
ChannelGroups = channelGroups
76
76
} ;
77
77
78
- networkStatus = await CheckSocketConnect < T > ( state ) . ConfigureAwait ( false ) ;
78
+ CheckSocketConnect < T > ( state ) . ConfigureAwait ( false ) ;
79
79
return networkStatus ;
80
80
}
81
81
@@ -100,6 +100,7 @@ private static async Task<bool> CheckSocketConnect<T>(object internetState)
100
100
try {
101
101
var gotTimeResp = await GetTimeWithTaskFactoryAsync ( ) . ConfigureAwait ( false ) ;
102
102
isInternetCheckRunning = gotTimeResp ;
103
+ networkStatus = gotTimeResp ;
103
104
} catch ( Exception ex ) {
104
105
networkStatus = false ;
105
106
LoggingMethod . WriteToLog ( pubnubLog , string . Format ( CultureInfo . InvariantCulture , "DateTime {0} CheckSocketConnect (HttpClient Or Task.Factory) Failed {1}" , DateTime . Now . ToString ( CultureInfo . InvariantCulture ) , ex . Message ) , pubnubConfig . LogVerbosity ) ;
0 commit comments