Skip to content
Snippets Groups Projects
Commit 46e50ef8 authored by Dmitriy A. Gerasimov's avatar Dmitriy A. Gerasimov
Browse files

[!] Returned throwing esocket between reactor and processor

parent 385d7488
No related branches found
No related tags found
No related merge requests found
......@@ -225,11 +225,12 @@ inline static bool _is_supported_user_agents_list_setted()
return cnt;
}
inline static void _set_only_write_http_client_state(dap_http_simple_t * a_simple)
inline static void s_set_writable_flags(dap_http_simple_t * a_simple)
{
// log_it(L_DEBUG,"_set_only_write_http_client_state");
a_simple->http_client->state_write=DAP_HTTP_CLIENT_STATE_START;
dap_events_socket_set_writable_mt(a_simple->worker, a_simple->http_client->esocket,true);
// log_it(L_DEBUG,"_set_only_write_http_client_state");
a_simple->http_client->state_write=DAP_HTTP_CLIENT_STATE_START;
dap_events_socket_set_writable_unsafe( a_simple->http_client->esocket,true);
}
static void _copy_reply_and_mime_to_response( dap_http_simple_t *a_simple )
......@@ -289,7 +290,8 @@ bool s_proc_queue_callback(dap_proc_thread_t * a_thread, void * a_arg )
if(header == NULL && is_unknown_user_agents_pass == false) {
const char error_msg[] = "Not found User-Agent HTTP header";
_write_response_bad_request(l_http_simple, error_msg);
_set_only_write_http_client_state( l_http_simple);
s_set_writable_flags( l_http_simple);
dap_proc_thread_assign_on_worker_inter(a_thread, l_http_simple->worker, l_http_simple->esocket);
return true;
}
......@@ -297,7 +299,8 @@ bool s_proc_queue_callback(dap_proc_thread_t * a_thread, void * a_arg )
log_it(L_DEBUG, "Not supported user agent in request: %s", header->value);
const char* error_msg = "User-Agent version not supported. Update your software";
_write_response_bad_request(l_http_simple, error_msg);
_set_only_write_http_client_state( l_http_simple);
s_set_writable_flags( l_http_simple);
dap_proc_thread_assign_on_worker_inter(a_thread, l_http_simple->worker, l_http_simple->esocket);
return true;
}
}
......@@ -313,7 +316,8 @@ bool s_proc_queue_callback(dap_proc_thread_t * a_thread, void * a_arg )
l_http_simple->http_client->reply_status_code = Http_Status_InternalServerError;
}
_set_only_write_http_client_state( l_http_simple);
s_set_writable_flags( l_http_simple);
dap_proc_thread_assign_on_worker_inter(a_thread, l_http_simple->worker, l_http_simple->esocket);
return true;
}
......@@ -348,7 +352,7 @@ static void s_http_client_headers_read( dap_http_client_t *a_http_client, void *
log_it(L_ERROR, "Not defined content-length %u in request", a_http_client->in_content_length);
} else {
log_it( L_DEBUG, "No data section, execution proc callback" );
dap_events_socket_set_writable_unsafe(a_http_client->esocket,false);
dap_events_socket_remove_from_worker_unsafe(l_http_simple->esocket ,l_http_simple->worker);
dap_proc_queue_add_callback_inter( l_http_simple->worker->proc_queue_input, s_proc_queue_callback, l_http_simple);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment