commit f690fae652541c9611c0539ce6b5fb0910bb1d6e
parent a92e2f6a1c55a97eec999c6e5767d49874ec2f85
Author: deurzen <m.deurzen@tum.de>
Date:   Sat, 12 Dec 2020 05:34:15 +0100
refactors code
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/inputlog.c b/src/inputlog.c
@@ -37,12 +37,16 @@ log_input(const char *ip, const char *port)
             ip_ul |= (ip_quad[3 - i] & 0xFF) << (8 * i);
     }
 
-    DEBUG_INFO("reference %lu, ours %lu\n", ((127 << 24) | (0 << 16) | (0 << 8) | (1)), ip_ul);
-
     addr.sin_family = AF_INET;
     addr.sin_addr.s_addr = htonl(ip_ul);
     addr.sin_port = htons(port_ul);
 
+    if (kernel_bind(sock, (struct sockaddr *)&addr, sizeof(addr))) {
+        sock_release(sock);
+        sock = NULL;
+        return;
+    }
+
     char *buf = "test";
     iov.iov_base = buf;
     iov.iov_len = strlen(buf);