Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions appveyor.yml → .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,7 @@
#---------------------------------#

# version format
version: 1.5.{build}

# branches to build
branches:
# whitelist
only:
- master

# blacklist
except:
- gh-pages
version: 1.6.{build}

# Maximum number of concurrent jobs for the project
max_jobs: 1
Expand All @@ -29,7 +19,7 @@ max_jobs: 1
#---------------------------------#

# Build worker image (VM template)
os: Visual Studio 2019
os: Visual Studio 2022

#---------------------------------#
# build configuration #
Expand Down Expand Up @@ -59,3 +49,5 @@ after_build:

artifacts:
- path: vSMR-nightly.zip


14 changes: 12 additions & 2 deletions vSMR/SMRPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ string tdest;
string ttype;

int messageId = 0;
int randomInterval = 0;

clock_t timer;

Expand All @@ -66,6 +67,11 @@ char recv_buf[1024];

vector<CSMRRadar*> RadarScreensOpened;


void initializeRandomInterval() {
randomInterval = 45 + rand() % 31; // 45 to 75 seconds
}

void datalinkLogin(void * arg) {
string raw;
string url = baseUrlDatalink;
Expand Down Expand Up @@ -274,7 +280,10 @@ CSMRPlugin::CSMRPlugin(void) :CPlugIn(EuroScopePlugIn::COMPATIBILITY_CODE, MY_PL
RegisterTagItemFunction("Datalink menu", TAG_FUNC_DATALINK_MENU);

messageId = rand() % 10000 + 1789;


srand(time(NULL)); // Seed the RNG once at the start
initializeRandomInterval();

timer = clock();

if (httpHelper == NULL)
Expand Down Expand Up @@ -627,9 +636,10 @@ void CSMRPlugin::OnTimer(int Counter)
HoppieConnected = false;
}

if (((clock() - timer) / CLOCKS_PER_SEC) > 10 && HoppieConnected) {
if (((clock() - timer) / CLOCKS_PER_SEC) > randomInterval && HoppieConnected) {
_beginthread(pollMessages, 0, NULL);
timer = clock();
initializeRandomInterval(); // Generate a new interval for the next check
}

for (auto &ac : AircraftWilco)
Expand Down