Loading src/event-timeout.c +7 −5 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ code and causing the bug to come back again. */ #include "event-timeout.h" #include "logger.h" #include <stdint.h> #include <stdlib.h> #include <string.h> Loading Loading @@ -78,13 +79,14 @@ timeouts_add(struct Timeouts *timeouts, struct TimeoutEntry *entry, size_t offset, uint64_t timestamp) { unsigned index; //time_t now = time(0); //time_t time_future = (unsigned)(timestamp/16384ULL); /* Unlink from wherever the entry came from */ timeout_unlink(entry); //printf("++ADD %d.%03u\n", time_future-now, (unsigned)(((timestamp%16384ULL)/16384.0)*1000.0)); if (entry->prev) { LOG(1, "***CHANGE %d-seconds\n", (int)((timestamp-entry->timestamp)/16384ULL)); } /* Initialize the new entry */ entry->timestamp = timestamp; entry->offset = (unsigned)offset; Loading @@ -96,10 +98,10 @@ timeouts_add(struct Timeouts *timeouts, struct TimeoutEntry *entry, entry->prev = &timeouts->slots[index]; if (entry->next) entry->next->prev = &entry->next; //printf("++PREV=0x%llx\n", entry->prev); } /*************************************************************************** * Remove the next event that it older than the specified timestamp ***************************************************************************/ void * timeouts_remove(struct Timeouts *timeouts, uint64_t timestamp) Loading @@ -112,7 +114,7 @@ timeouts_remove(struct Timeouts *timeouts, uint64_t timestamp) /* Start at the current slot */ entry = timeouts->slots[timeouts->current_index & timeouts->mask]; /* enumerate throug the linked list until we find one */ /* enumerate through the linked list until we find a used slot */ while (entry && entry->timestamp > timestamp) entry = entry->next; if (entry) Loading src/event-timeout.h +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ timeout_unlink(struct TimeoutEntry *entry) entry->next = 0; entry->prev = 0; entry->timestamp = 0; //printf("--PREV=0x%llx\n", entry->prev); } /*************************************************************************** Loading @@ -69,6 +68,7 @@ void *timeouts_remove(struct Timeouts *timeouts, uint64_t timestamp); * that we use for timeouts. The timeval structure probably will come * from the packets that we are capturing. */ #define TICKS_PER_SECOND (16384ULL) #define TICKS_FROM_SECS(secs) ((secs)*16384ULL) #define TICKS_FROM_USECS(usecs) ((usecs)/16384ULL) #define TICKS_FROM_TV(secs,usecs) (TICKS_FROM_SECS(secs)+TICKS_FROM_USECS(usecs)) Loading src/main-status.c +2 −1 Original line number Diff line number Diff line Loading @@ -123,6 +123,7 @@ status_print( syn_rate = (1.0*current_syns)/elapsed_time; } /* * Print the message to <stderr> so that <stdout> can be redirected * to a file (<stdout> reports what systems were found). Loading @@ -136,7 +137,7 @@ status_print( tcb_rate, global_tcb_count ); } else { } else if (rate > 0) { fprintf(stderr, "rate:%6.2f-kpps, %5.2f%% done,%4u:%02u:%02u remaining, %llu-tcbs, rr=%.0f \r", x/1000.0, Loading src/main.c +7 −2 Original line number Diff line number Diff line Loading @@ -603,7 +603,7 @@ receive_thread(void *v) unsigned cookie; /* * RECIEVE * RECEIVE * * This is the boring part of actually receiving a packet */ Loading @@ -614,8 +614,11 @@ receive_thread(void *v) &usecs, &px); if (err != 0) if (err != 0) { if (tcpcon) tcpcon_timeouts(tcpcon, (unsigned)time(0), 0); continue; } /* Loading Loading @@ -928,6 +931,8 @@ main_scan(struct Masscan *masscan) struct Status status; uint64_t min_index = UINT64_MAX; memset(parms_array, 0, sizeof(parms_array)); /* * Initialize the task size */ Loading src/output.c +1 −2 Original line number Diff line number Diff line Loading @@ -618,8 +618,7 @@ output_report_status(struct Output *out, time_t timestamp, int status, if (out->is_interactive) { unsigned count; count = fprintf(stdout, "Discovered %s port %u/%s on %u.%u.%u.%u" " \n", count = fprintf(stdout, "Discovered %s port %u/%s on %u.%u.%u.%u", status_string(status), port, proto_from_status(status), Loading Loading
src/event-timeout.c +7 −5 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ code and causing the bug to come back again. */ #include "event-timeout.h" #include "logger.h" #include <stdint.h> #include <stdlib.h> #include <string.h> Loading Loading @@ -78,13 +79,14 @@ timeouts_add(struct Timeouts *timeouts, struct TimeoutEntry *entry, size_t offset, uint64_t timestamp) { unsigned index; //time_t now = time(0); //time_t time_future = (unsigned)(timestamp/16384ULL); /* Unlink from wherever the entry came from */ timeout_unlink(entry); //printf("++ADD %d.%03u\n", time_future-now, (unsigned)(((timestamp%16384ULL)/16384.0)*1000.0)); if (entry->prev) { LOG(1, "***CHANGE %d-seconds\n", (int)((timestamp-entry->timestamp)/16384ULL)); } /* Initialize the new entry */ entry->timestamp = timestamp; entry->offset = (unsigned)offset; Loading @@ -96,10 +98,10 @@ timeouts_add(struct Timeouts *timeouts, struct TimeoutEntry *entry, entry->prev = &timeouts->slots[index]; if (entry->next) entry->next->prev = &entry->next; //printf("++PREV=0x%llx\n", entry->prev); } /*************************************************************************** * Remove the next event that it older than the specified timestamp ***************************************************************************/ void * timeouts_remove(struct Timeouts *timeouts, uint64_t timestamp) Loading @@ -112,7 +114,7 @@ timeouts_remove(struct Timeouts *timeouts, uint64_t timestamp) /* Start at the current slot */ entry = timeouts->slots[timeouts->current_index & timeouts->mask]; /* enumerate throug the linked list until we find one */ /* enumerate through the linked list until we find a used slot */ while (entry && entry->timestamp > timestamp) entry = entry->next; if (entry) Loading
src/event-timeout.h +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ timeout_unlink(struct TimeoutEntry *entry) entry->next = 0; entry->prev = 0; entry->timestamp = 0; //printf("--PREV=0x%llx\n", entry->prev); } /*************************************************************************** Loading @@ -69,6 +68,7 @@ void *timeouts_remove(struct Timeouts *timeouts, uint64_t timestamp); * that we use for timeouts. The timeval structure probably will come * from the packets that we are capturing. */ #define TICKS_PER_SECOND (16384ULL) #define TICKS_FROM_SECS(secs) ((secs)*16384ULL) #define TICKS_FROM_USECS(usecs) ((usecs)/16384ULL) #define TICKS_FROM_TV(secs,usecs) (TICKS_FROM_SECS(secs)+TICKS_FROM_USECS(usecs)) Loading
src/main-status.c +2 −1 Original line number Diff line number Diff line Loading @@ -123,6 +123,7 @@ status_print( syn_rate = (1.0*current_syns)/elapsed_time; } /* * Print the message to <stderr> so that <stdout> can be redirected * to a file (<stdout> reports what systems were found). Loading @@ -136,7 +137,7 @@ status_print( tcb_rate, global_tcb_count ); } else { } else if (rate > 0) { fprintf(stderr, "rate:%6.2f-kpps, %5.2f%% done,%4u:%02u:%02u remaining, %llu-tcbs, rr=%.0f \r", x/1000.0, Loading
src/main.c +7 −2 Original line number Diff line number Diff line Loading @@ -603,7 +603,7 @@ receive_thread(void *v) unsigned cookie; /* * RECIEVE * RECEIVE * * This is the boring part of actually receiving a packet */ Loading @@ -614,8 +614,11 @@ receive_thread(void *v) &usecs, &px); if (err != 0) if (err != 0) { if (tcpcon) tcpcon_timeouts(tcpcon, (unsigned)time(0), 0); continue; } /* Loading Loading @@ -928,6 +931,8 @@ main_scan(struct Masscan *masscan) struct Status status; uint64_t min_index = UINT64_MAX; memset(parms_array, 0, sizeof(parms_array)); /* * Initialize the task size */ Loading
src/output.c +1 −2 Original line number Diff line number Diff line Loading @@ -618,8 +618,7 @@ output_report_status(struct Output *out, time_t timestamp, int status, if (out->is_interactive) { unsigned count; count = fprintf(stdout, "Discovered %s port %u/%s on %u.%u.%u.%u" " \n", count = fprintf(stdout, "Discovered %s port %u/%s on %u.%u.%u.%u", status_string(status), port, proto_from_status(status), Loading