This commit addes global value for checking webclieng running status.
If webclient example runs twice at a time, global values like g_https
and g_async can be destroyed by latter webclient app.
Change-Id: I49644810de070c09d10e5d2c4bad402d35e5e505
Signed-off-by: Junyeon LEE <junyeon2.lee@samsung.com>
sizeof(c_ca_crt_rsa), sizeof(c_cli_crt_rsa), sizeof(c_cli_key_rsa), 2
};
+static int g_running;
static int g_https;
static int g_async;
static int g_testentity;
pthread_t tid;
struct webclient_input arg;
+ if (g_running) {
+ printf("Previous request is in process, Please wait.\n");
+ return -1;
+ } else {
+ g_running = 1;
+ }
+
status = pthread_attr_init(&attr);
if (status != 0) {
printf("fail to start webclient\n");
+ g_running = 0;
return -1;
}
status = pthread_create(&tid, &attr, webclient_cb, &arg);
if (status < 0) {
printf("fail to start webclient\n");
+ g_running = 0;
return -1;
}
pthread_setname_np(tid, "webclient");
pthread_join(tid, NULL);
+ g_running = 0;
return 0;
}