Skip to content

Display and control your Android device

Move net_init() and net_cleanup() upwards

Romain Vimonteb6afe76698e
diff --git a/app/src/util/net.c b/app/src/util/net.c
index 2b5a0e5e..4b5a4874 100644
--- a/app/src/util/net.c
+++ b/app/src/util/net.c
@@ -19,6 +19,26 @@
typedef struct in_addr IN_ADDR;
#endif
+bool
+net_init(void) {
+#ifdef __WINDOWS__
+ WSADATA wsa;
+ int res = WSAStartup(MAKEWORD(2, 2), &wsa) < 0;
+ if (res < 0) {
+ LOGC("WSAStartup failed with error %d", res);
+ return false;
+ }
+#endif
+ return true;
+}
+
+void
+net_cleanup(void) {
+#ifdef __WINDOWS__
+ WSACleanup();
+#endif
+}
+
static void
net_perror(const char *s) {
#ifdef _WIN32
@@ -133,26 +153,6 @@ net_shutdown(socket_t socket, int how) {
return !shutdown(socket, how);
}
-bool
-net_init(void) {
-#ifdef __WINDOWS__
- WSADATA wsa;
- int res = WSAStartup(MAKEWORD(2, 2), &wsa) < 0;
- if (res < 0) {
- LOGC("WSAStartup failed with error %d", res);
- return false;
- }
-#endif
- return true;
-}
-
-void
-net_cleanup(void) {
-#ifdef __WINDOWS__
- WSACleanup();
-#endif
-}
-
bool
net_close(socket_t socket) {
#ifdef __WINDOWS__