diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2022-10-31 10:26:32 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2022-10-31 10:26:32 +0800 |
commit | 69c7965e505e611486f6cd1b063f07dd1bfaec22 (patch) | |
tree | b7d9cecb4c44bbae455cd65bfed53c03a1d4b69e /midtrans.c | |
parent | 5f92db4ea8e72b8f341c85d4da23b185b4cb55f7 (diff) |
Not asynchronous for now
Diffstat (limited to 'midtrans.c')
-rw-r--r-- | midtrans.c | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -2,7 +2,6 @@ #include <string.h> #include <openssl/bio.h> #include <openssl/evp.h> -#include <pthread.h> #include <curl/curl.h> #include <json.h> #include "midtrans.h" @@ -13,8 +12,6 @@ static _Bool production = 0; static char *base_url; static CURL *curl; static struct curl_slist *slist; -static pthread_t *threads; -static size_t num_threads = 0; struct response { size_t size; @@ -106,8 +103,7 @@ void midtrans_status(const char *order_id) sprintf(url, tmpl, base_url, production ? order_id : ORDER_ID); curl_easy_setopt(curl, CURLOPT_URL, url); - threads = realloc(threads, ++num_threads * sizeof(pthread_t)); - pthread_create(&threads[num_threads - 1], NULL, request, NULL); + request(NULL); } void midtrans_charge_banktransfer(struct midtrans_banktransfer *banktransfer, @@ -178,14 +174,11 @@ void midtrans_charge_banktransfer(struct midtrans_banktransfer *banktransfer, free(payment); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post); - threads = realloc(threads, ++num_threads * sizeof(pthread_t)); - pthread_create(&threads[num_threads - 1], NULL, request, NULL); + request(NULL); } void midtrans_cleanup() { - for (size_t i = 0; i < num_threads; i++) - pthread_join(threads[i], NULL); free(base_url); curl_slist_free_all(slist); curl_easy_cleanup(curl); |