Skip to content

Commit

Permalink
webhook bugfix, update check bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Sep 16, 2018
1 parent 59e1703 commit 484abc5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void Config::checkForUpdates() {
json_t* url = json_object_get(root, "tag_name");
const char *urlText = json_string_value(url);
float latestVer = stof(urlText);
float currentVer = 0.9;
float currentVer = 0.92;
if(latestVer > currentVer) {
json_t* url2 = json_object_get(root, "html_url");
const char *urlText2 = json_string_value(url2);
Expand Down
19 changes: 3 additions & 16 deletions Webhook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,17 @@ void Webhook::notify(SC2State*& previous, SC2State*& current) {
event = "enter";
}

if(event != "") {
sendRequest(current, event);
if (event != "") {
sendRequest(current, event);
}
}
}

void Webhook::sendRequest(SC2State*& game, std::string event) {
void Webhook::sendRequest(SC2State*& game, std::string event) {
if(!game->fullState.isReplay) {
Config* cfg = Config::Current();

int still_running = 0;
int repeats = 0;
CURLM *multi_handle;
multi_handle = curl_multi_init();

Expand Down Expand Up @@ -75,20 +74,8 @@ void Webhook::notify(SC2State*& previous, SC2State*& current) {
if(mc != CURLM_OK) {
break;
}

if(!numfds) {
repeats++;
if(repeats > 1) {
break;
}
}
else {
repeats = 0;
}

curl_multi_perform(multi_handle, &still_running);
}

// clean up each handle
for (CURL* &handle : handles) {
curl_multi_remove_handle(multi_handle, handle);
Expand Down

0 comments on commit 484abc5

Please sign in to comment.