]> git.meshlink.io Git - meshlink/blobdiff - src/protocol.c
Never automatically try to bind to ports >= 32768.
[meshlink] / src / protocol.c
index 5da89c7d4ea272549f97603f1dd3261d099045f5..9975402c592c14ed5a9d6d7edce90cce5f2caa66 100644 (file)
@@ -44,6 +44,7 @@ static bool (*request_handlers[NUM_REQUESTS])(meshlink_handle_t *, connection_t
        [KEY_CHANGED] = key_changed_h,
        [REQ_KEY] = req_key_h,
        [ANS_KEY] = ans_key_h,
+       [PACKET] = raw_packet_h,
 };
 
 /* Request names */
@@ -61,6 +62,7 @@ static const char *request_name[NUM_REQUESTS] = {
        [KEY_CHANGED] = "KEY_CHANGED",
        [REQ_KEY] = "REQ_KEY",
        [ANS_KEY] = "ANS_KEY",
+       [PACKET] = "PACKET",
 };
 
 bool check_id(const char *id) {
@@ -228,7 +230,7 @@ bool seen_request(meshlink_handle_t *mesh, const char *request) {
                new->request = xstrdup(request);
                new->firstseen = mesh->loop.now.tv_sec;
 
-               if(!mesh->past_request_tree->head) {
+               if(!mesh->past_request_tree->head && mesh->past_request_timeout.cb) {
                        timeout_set(&mesh->loop, &mesh->past_request_timeout, &(struct timespec) {
                                10, prng(mesh, TIMER_FUDGE)
                        });