File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed
src/main/kotlin/com/lambda/client/manager/managers Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,6 @@ package com.lambda.client.manager.managers
2
2
3
3
import com.lambda.client.manager.Manager
4
4
import com.lambda.client.util.threads.BackgroundScope
5
- import com.lambda.client.util.threads.defaultScope
6
- import kotlinx.coroutines.Dispatchers
7
- import kotlinx.coroutines.launch
8
5
import java.net.InetSocketAddress
9
6
import java.net.Socket
10
7
@@ -14,15 +11,14 @@ object NetworkManager : Manager {
14
11
15
12
init {
16
13
BackgroundScope .launchLooping(" offline" , 1500L ) {
17
- defaultScope.launch(Dispatchers .IO ) {
18
- isOffline = try {
19
- Socket ().use { socket ->
20
- socket.connect(InetSocketAddress (" 1.1.1.1" , 80 ), 100 )
21
- false
22
- }
23
- } catch (e: Exception ) {
24
- true // Either timeout or unreachable or failed DNS lookup.
14
+ @Suppress(" BlockingMethodInNonBlockingContext" )
15
+ isOffline = try {
16
+ Socket ().use { socket ->
17
+ socket.connect(InetSocketAddress (" 1.1.1.1" , 80 ), 100 )
18
+ false
25
19
}
20
+ } catch (e: Exception ) {
21
+ true // Either timeout or unreachable or failed DNS lookup.
26
22
}
27
23
}
28
24
}
You can’t perform that action at this time.
0 commit comments