GNU libmicrohttpd
0.9.72
|
Methods for managing connections. More...
#include "internal.h"
Go to the source code of this file.
Macros | |
#define | MHD_ERR_AGAIN_ (-3073) |
#define | MHD_ERR_CONNRESET_ (-3074) |
#define | MHD_ERR_NOTCONN_ (-3075) |
#define | MHD_ERR_NOMEM_ (-3076) |
#define | MHD_ERR_BADF_ (-3077) |
#define | MHD_ERR_INVAL_ (-3078) |
#define | MHD_connection_finish_forward_(conn) (void) conn |
Functions | |
void | MHD_set_http_callbacks_ (struct MHD_Connection *connection) |
void | MHD_connection_handle_read (struct MHD_Connection *connection) |
void | MHD_connection_handle_write (struct MHD_Connection *connection) |
enum MHD_Result | MHD_connection_handle_idle (struct MHD_Connection *connection) |
void | MHD_connection_mark_closed_ (struct MHD_Connection *connection) |
void | MHD_connection_close_ (struct MHD_Connection *connection, enum MHD_RequestTerminationCode termination_code) |
void | MHD_update_last_activity_ (struct MHD_Connection *connection) |
Methods for managing connections.
Definition in file connection.h.
#define MHD_connection_finish_forward_ | ( | conn | ) | (void) conn |
Definition at line 148 of file connection.h.
#define MHD_ERR_AGAIN_ (-3073) |
Error code similar to EGAIN or EINTR
Definition at line 36 of file connection.h.
#define MHD_ERR_BADF_ (-3077) |
"Bad FD" error code
Definition at line 57 of file connection.h.
#define MHD_ERR_CONNRESET_ (-3074) |
Connection was hard-closed by remote peer.
Definition at line 41 of file connection.h.
#define MHD_ERR_INVAL_ (-3078) |
Error code similar to EINVAL
Definition at line 62 of file connection.h.
#define MHD_ERR_NOMEM_ (-3076) |
"Not enough memory" error code
Definition at line 52 of file connection.h.
#define MHD_ERR_NOTCONN_ (-3075) |
Connection is not connected anymore due to network error or any other reason.
Definition at line 47 of file connection.h.
void MHD_connection_close_ | ( | struct MHD_Connection * | connection, |
enum MHD_RequestTerminationCode | termination_code | ||
) |
Close the given connection and give the specified termination code to the user.
connection | connection to close |
termination_code | termination reason to give |
Close the given connection and give the specified termination code to the user.
connection | connection to close |
rtc | termination reason to give |
Definition at line 83 of file connection_close.c.
References MHD_Connection::client_aware, MHD_Connection::client_context, MHD_Connection::daemon, mhd_assert, MHD_connection_mark_closed_(), MHD_CONNECTION_NOTIFY_CLOSED, MHD_destroy_response(), MHD_response_queue_for_destroy(), MHD_USE_INTERNAL_POLLING_THREAD, MHD_Daemon::notify_completed, MHD_Daemon::notify_completed_cls, MHD_Daemon::notify_connection_cb, MHD_Daemon::notify_connection_cb_cls, NULL, MHD_Daemon::options, MHD_Connection::pid, MHD_Connection::request, MHD_Request::response, and MHD_Connection::response.
Referenced by close_connection(), connection_close_error(), MHD_connection_call_handlers_(), MHD_connection_handle_read(), MHD_request_handle_idle_(), MHD_request_handle_read_(), MHD_run_tls_handshake_(), thread_main_handle_connection(), and try_ready_normal_body().
enum MHD_Result MHD_connection_handle_idle | ( | struct MHD_Connection * | connection | ) |
This function was created to handle per-connection processing that has to happen even if the socket cannot be read or written to. All implementations (multithreaded, external select, internal select) call this function.
connection | connection to handle |
This function was created to handle per-connection processing that has to happen even if the socket cannot be read or written to.
connection | connection to handle |
Definition at line 3154 of file connection.c.
void MHD_connection_handle_read | ( | struct MHD_Connection * | connection | ) |
This function handles a particular connection when it has been determined that there is data to be read off a socket. All implementations (multithreaded, external select, internal select) call this function to handle reads.
connection | connection to handle |
This function handles a particular connection when it has been determined that there is data to be read off a socket.
connection | connection to handle |
Definition at line 2738 of file connection.c.
References _, CONNECTION_CLOSE_ERROR, MHD_Connection::daemon, mhd_assert, MHD_CONNECTION_BODY_RECEIVED, MHD_connection_close_(), MHD_CONNECTION_CLOSED, MHD_CONNECTION_CONTINUE_SENDING, MHD_CONNECTION_CONTINUE_SENT, MHD_CONNECTION_FOOTER_PART_RECEIVED, MHD_CONNECTION_HEADER_PART_RECEIVED, MHD_CONNECTION_HEADERS_PROCESSED, MHD_CONNECTION_HEADERS_RECEIVED, MHD_CONNECTION_INIT, MHD_CONNECTION_URL_RECEIVED, MHD_ERR_AGAIN_, MHD_ERR_CONNRESET_, MHD_pool_reallocate(), MHD_REQUEST_TERMINATED_CLIENT_ABORT, MHD_REQUEST_TERMINATED_READ_ERROR, MHD_run_tls_handshake_(), MHD_TLS_CONN_CONNECTED, MHD_TLS_CONN_NO_TLS, MHD_update_last_activity_(), NULL, MHD_Connection::pool, MHD_Daemon::pool_increment, MHD_Connection::read_buffer, MHD_Connection::read_buffer_offset, MHD_Connection::read_buffer_size, MHD_Connection::read_closed, MHD_Connection::recv_cls, MHD_Connection::state, MHD_Connection::suspended, and try_grow_read_buffer().
void MHD_connection_handle_write | ( | struct MHD_Connection * | connection | ) |
This function was created to handle writes to sockets when it has been determined that the socket can be written to. All implementations (multithreaded, external select, internal select) call this function
connection | connection to handle |
This function was created to handle writes to sockets when it has been determined that the socket can be written to.
connection | connection to handle |
Definition at line 2851 of file connection.c.
References _, check_write_done(), CONNECTION_CLOSE_ERROR, MHD_Connection::continue_message_write_offset, MHD_Response::crc, MHD_Connection::daemon, MHD_Response::data, MHD_Response::data_size, MHD_Response::data_start, MHD_Connection::have_chunked_upload, HTTP_100_CONTINUE, mhd_assert, MHD_CONNECTION_BODY_RECEIVED, MHD_CONNECTION_BODY_SENT, MHD_CONNECTION_CHUNKED_BODY_READY, MHD_CONNECTION_CHUNKED_BODY_UNREADY, MHD_CONNECTION_CLOSED, MHD_CONNECTION_CONTINUE_SENDING, MHD_CONNECTION_CONTINUE_SENT, MHD_CONNECTION_FOOTER_PART_RECEIVED, MHD_CONNECTION_FOOTERS_RECEIVED, MHD_CONNECTION_FOOTERS_SENDING, MHD_CONNECTION_FOOTERS_SENT, MHD_CONNECTION_HEADER_PART_RECEIVED, MHD_CONNECTION_HEADERS_PROCESSED, MHD_CONNECTION_HEADERS_RECEIVED, MHD_CONNECTION_HEADERS_SENDING, MHD_CONNECTION_HEADERS_SENT, MHD_CONNECTION_INIT, MHD_CONNECTION_NORMAL_BODY_READY, MHD_CONNECTION_NORMAL_BODY_UNREADY, MHD_CONNECTION_URL_RECEIVED, MHD_ERR_AGAIN_, MHD_mutex_lock_chk_, MHD_mutex_unlock_chk_, MHD_NO, MHD_PANIC, MHD_run_tls_handshake_(), MHD_send_data_(), MHD_send_hdr_and_body_(), MHD_SIZE_UNKNOWN, MHD_STATICSTR_LEN_, MHD_TLS_CONN_CONNECTED, MHD_TLS_CONN_NO_TLS, MHD_update_last_activity_(), MHD_Response::mutex, NULL, MHD_Connection::response, MHD_Connection::response_write_position, SIZE_MAX, MHD_Connection::state, MHD_Connection::suspended, MHD_Response::total_size, try_ready_normal_body(), MHD_Connection::url, MHD_Connection::write_buffer, MHD_Connection::write_buffer_append_offset, and MHD_Connection::write_buffer_send_offset.
void MHD_connection_mark_closed_ | ( | struct MHD_Connection * | connection | ) |
Mark connection as "closed".
connection | connection to close |
Definition at line 36 of file connection_close.c.
References MHD_TLS_Plugin::cls, MHD_Connection::daemon, MHD_Daemon::enable_turbo, MHD_Request::event_loop_info, MHD_Connection::event_loop_info, MHD_CONNECTION_CLOSED, MHD_EVENT_LOOP_INFO_CLEANUP, MHD_REQUEST_CLOSED, MHD_tls_connection_shutdown(), MHD_USE_TLS, MHD_USE_TURBO, MHD_YES, NULL, MHD_Daemon::options, MHD_Connection::request, MHD_Daemon::shutdown, MHD_TLS_Plugin::shutdown_connection, MHD_Connection::socket_fd, MHD_Request::state, and MHD_Connection::state.
Referenced by close_connection(), and MHD_connection_close_().
void MHD_set_http_callbacks_ | ( | struct MHD_Connection * | connection | ) |
Set callbacks for this connection to those for HTTP.
connection | connection to initialize |
Definition at line 3776 of file connection.c.
References MHD_Connection::recv_cls, and recv_param_adapter().
Referenced by internal_add_connection().
void MHD_update_last_activity_ | ( | struct MHD_Connection * | connection | ) |
Update the 'last_activity' field of the connection to the current time and move the connection to the head of the 'normal_timeout' list if the timeout for the connection uses the default value.
connection | the connection that saw some activity |
Definition at line 88 of file connection_options.c.
References MHD_Daemon::cleanup_connection_mutex, MHD_Daemon::connection_default_timeout, MHD_Connection::connection_timeout, MHD_Daemon::connection_timeout, MHD_Connection::daemon, MHD_Connection::last_activity, MHD_monotonic_sec_counter(), MHD_mutex_lock_chk_, MHD_mutex_unlock_chk_, MHD_USE_THREAD_PER_CONNECTION, MHD_Daemon::normal_timeout_head, MHD_Daemon::normal_timeout_tail, MHD_Daemon::options, MHD_Connection::suspended, MHD_Daemon::threading_mode, XDLL_insert, and XDLL_remove.
Referenced by MHD_connection_handle_read(), MHD_connection_handle_write(), and MHD_run_tls_handshake_().