]> git.meshlink.io Git - meshlink/blobdiff - src/meshlink.c
Add #include "crypto.h" because we are using randomize().
[meshlink] / src / meshlink.c
index 319c765cdffaf7394bdaa136700d69231fc213a0..cd5b5642538a97ef441995bba9dca5c26e634e99 100644 (file)
@@ -40,6 +40,9 @@ typedef struct {
 #include "xalloc.h"
 #include "ed25519/sha512.h"
 
+#ifndef MSG_NOSIGNAL
+#define MSG_NOSIGNAL 0
+#endif
 
 //TODO: this can go away completely
 const var_t variables[] = {
@@ -794,6 +797,11 @@ meshlink_handle_t *meshlink_open(const char *confbase, const char *name) {
        if(!read_server_config(mesh))
                return meshlink_close(mesh), NULL;
 
+#ifdef HAVE_MINGW
+       struct WSAData wsa_state;
+       WSAStartup(MAKEWORD(2, 2), &wsa_state);
+#endif
+
        // Setup up everything
        // TODO: we should not open listening sockets yet
 
@@ -849,6 +857,10 @@ void meshlink_close(meshlink_handle_t *mesh) {
 
        exit_configuration(&mesh->config);
        event_loop_exit(&mesh->loop);
+
+#ifdef HAVE_MINGW
+       WSACleanup();
+#endif
 }
 
 void meshlink_set_receive_cb(meshlink_handle_t *mesh, meshlink_receive_cb_t cb) {
@@ -1254,7 +1266,7 @@ void meshlink_blacklist(meshlink_handle_t *mesh, meshlink_node_t *node) {
        fprintf(stderr, "Blacklisted %s.\n",node->name);
 
        //Make blacklisting persistent in the config file
-       append_config_file(mesh, n->name, "blacklisted", "1");
+       append_config_file(mesh, n->name, "blacklisted", "yes");
     return;
 
 }