for(int i = 0; i < n; i++) {
snprintf(nodename, sizeof(nodename), "%snode%d", namesprefix, i);
snprintf(filename, sizeof(filename), "%s/%s", basebase, nodename);
- bool itsnew = access(filename, R_OK);
if(n / (i + 1) > n / 4)
mesh[i] = meshlink_open(filename, nodename, "manynodes", DEV_CLASS_BACKBONE);
else
#include "devtools.h"
-static int node_compare(const void *a, const void *b) {
- if(a < b)
- return -1;
-
- if(a > b)
- return 1;
-
- return 0;
-}
-
static bool fstrwrite(const char *str, FILE *stream) {
size_t len = strlen(str);
break;
case CATTA_LOG_DEBUG:
+ default:
mlevel = MESHLINK_DEBUG;
break;
}
meshlink_handle_t *handle;
};
-static const char *strerror(errno_t err = meshlink_errno) {
+static inline const char *strerror(errno_t err = meshlink_errno) {
return meshlink_strerror(err);
}
*
* @return This function will return true if the MeshLink instance was succesfully destroyed, false otherwise.
*/
-static bool destroy(const char *confbase) {
+static inline bool destroy(const char *confbase) {
return meshlink_destroy(confbase);
}
}
memset(hdr, 0, sizeof(*hdr));
// leave the last byte as 0 to make sure strings are always
// null-terminated if they are longer than the buffer
- strncpy(hdr->destination, destination->name, (sizeof(hdr)->destination) - 1);
- strncpy(hdr->source, mesh->self->name, (sizeof(hdr)->source) - 1);
+ strncpy((char *)hdr->destination, destination->name, (sizeof(hdr)->destination) - 1);
+ strncpy((char *)hdr->source, mesh->self->name, (sizeof(hdr)->source) - 1);
memcpy(packet->data + sizeof(*hdr), data, len);
#endif
/// The length in bytes of a signature made with meshlink_sign()
-#define MESHLINK_SIGLEN (64)
+#define MESHLINK_SIGLEN (64ul)
// The maximum length of fingerprints
-#define MESHLINK_FINGERPRINTLEN (64)
+#define MESHLINK_FINGERPRINTLEN (64ul)
/// A handle for an instance of MeshLink.
typedef struct meshlink_handle meshlink_handle_t;
int main(int argc, char *argv[]) {
- int fda[2], fdb[2], result;
+ int fda[2], fdb[2];
pipe2(fda, 0);
pipe2(fdb, 0);
#include <unistd.h>
#include <errno.h>
#include <assert.h>
+#include <sys/time.h>
#include "meshlink.h"
#include "utils.h"