Skip to content

Commit d604ad8

Browse files
committed
Check for network
1 parent 2852e7a commit d604ad8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

uploadservice/src/main/java/net/gotev/uploadservice/network/hurl/HurlStackRequest.kt

+6
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class HurlStackRequest(
3636
}
3737

3838
init {
39+
if (networkAvailable.not()) throw IOException()
40+
3941
UploadServiceLogger.debug(javaClass.simpleName, uploadId) {
4042
"creating new HttpURLConnection (uuid: $uuid)"
4143
}
@@ -140,4 +142,8 @@ class HurlStackRequest(
140142
} catch (ignored: Throwable) {
141143
}
142144
}
145+
146+
companion object {
147+
var networkAvailable = false
148+
}
143149
}

0 commit comments

Comments
 (0)