Skip to content

Commit 6063467

Browse files
function timeout
1 parent 5fb102b commit 6063467

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/consts.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ const char *VERSION_FLAGS[]={
6363
"version",
6464
"v"
6565
};
66+
const char *TIMEOUT_FLAGS[]={
67+
"timeout",
68+
"t"
69+
};
6670

6771
//====================================ROUTES=========================================
6872
const char *CWEB_FIRMWARE_ROUTE = "/cweb_firmware";

src/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ int main(int argc, char *argv[]){
4040
printf("--port not valid\n");
4141
return 1;
4242
}
43-
44-
43+
int timeout = 90; //two minuts
44+
const char *timeout_flag = CArgvParse_get_flag(&args, TIMEOUT_FLAGS, FLAGS_SIZE, 0);
45+
if(timeout_flag){
46+
timeout = atoi(timeout_flag);
47+
}
4548

4649
const char *dynamic_lib_entrie = CArgvParse_get_flag(&args,DYNAMIC_LIV_FLAGS,FLAGS_SIZE,0);
4750
if(!dynamic_lib_entrie){
@@ -87,6 +90,7 @@ int main(int argc, char *argv[]){
8790

8891

8992
CwebServer server = newCwebSever(port_num, main_sever);
93+
server.function_timeout = timeout;
9094
CwebServer_start(&server);
9195
return 0;
9296
}

0 commit comments

Comments
 (0)