|
|
@ -17,7 +17,7 @@
|
|
|
|
* @param module
|
|
|
|
* @param module
|
|
|
|
**/
|
|
|
|
**/
|
|
|
|
static inline void
|
|
|
|
static inline void
|
|
|
|
module_initialize_as_server(struct module *module)
|
|
|
|
module_listen(struct module *module)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Allocate a new socket
|
|
|
|
// Allocate a new socket
|
|
|
|
int socket_descriptor = socket(AF_INET, SOCK_STREAM, 0);
|
|
|
|
int socket_descriptor = socket(AF_INET, SOCK_STREAM, 0);
|
|
|
@ -162,7 +162,7 @@ module_new(char *name, char *path, i32 argument_count, u32 stack_size, u32 max_m
|
|
|
|
module_database_add(module);
|
|
|
|
module_database_add(module);
|
|
|
|
|
|
|
|
|
|
|
|
// Start listening for requests
|
|
|
|
// Start listening for requests
|
|
|
|
module_initialize_as_server(module);
|
|
|
|
module_listen(module);
|
|
|
|
|
|
|
|
|
|
|
|
return module;
|
|
|
|
return module;
|
|
|
|
|
|
|
|
|
|
|
@ -234,16 +234,16 @@ module_new_from_json(char *file_name)
|
|
|
|
memset(request_headers, 0, HTTP_MAX_HEADER_LENGTH * HTTP_MAX_HEADER_COUNT);
|
|
|
|
memset(request_headers, 0, HTTP_MAX_HEADER_LENGTH * HTTP_MAX_HEADER_COUNT);
|
|
|
|
char *reponse_headers = (char *)malloc(HTTP_MAX_HEADER_LENGTH * HTTP_MAX_HEADER_COUNT);
|
|
|
|
char *reponse_headers = (char *)malloc(HTTP_MAX_HEADER_LENGTH * HTTP_MAX_HEADER_COUNT);
|
|
|
|
memset(reponse_headers, 0, HTTP_MAX_HEADER_LENGTH * HTTP_MAX_HEADER_COUNT);
|
|
|
|
memset(reponse_headers, 0, HTTP_MAX_HEADER_LENGTH * HTTP_MAX_HEADER_COUNT);
|
|
|
|
i32 request_size = 0;
|
|
|
|
i32 request_size = 0;
|
|
|
|
i32 response_size = 0;
|
|
|
|
i32 response_size = 0;
|
|
|
|
i32 argument_count = 0;
|
|
|
|
i32 argument_count = 0;
|
|
|
|
u32 port = 0;
|
|
|
|
u32 port = 0;
|
|
|
|
u32 relative_deadline_us = 0;
|
|
|
|
u32 relative_deadline_us = 0;
|
|
|
|
i32 is_active = 0;
|
|
|
|
i32 is_active = 0;
|
|
|
|
i32 request_count = 0;
|
|
|
|
i32 request_count = 0;
|
|
|
|
i32 response_count = 0;
|
|
|
|
i32 response_count = 0;
|
|
|
|
int j = 1;
|
|
|
|
int j = 1;
|
|
|
|
int ntoks = 2 * tokens[i].size;
|
|
|
|
int ntoks = 2 * tokens[i].size;
|
|
|
|
char request_content_type[HTTP_MAX_HEADER_VALUE_LENGTH] = { 0 };
|
|
|
|
char request_content_type[HTTP_MAX_HEADER_VALUE_LENGTH] = { 0 };
|
|
|
|
char response_content_type[HTTP_MAX_HEADER_VALUE_LENGTH] = { 0 };
|
|
|
|
char response_content_type[HTTP_MAX_HEADER_VALUE_LENGTH] = { 0 };
|
|
|
|
|
|
|
|
|
|
|
|