maph 1.0.0 High-Performance Memory-Mapped Key-Value Database with O(1) Lookups

Loading...
Searching...
No Matches
Functions | Variables
loop.c File Reference
`#include "libusockets.h"`
`#include "internal/internal.h"`
`#include <stdlib.h>`
Include dependency graph for loop.c:

Go to the source code of this file.

## Functions
void | us_internal_loop_data_init (struct us_loop_t *loop, void(*wakeup_cb)(struct us_loop_t *loop), void(*pre_cb)(struct us_loop_t *loop), void(*post_cb)(struct us_loop_t *loop))
void | us_internal_loop_data_free (struct us_loop_t *loop)
void | us_wakeup_loop (struct us_loop_t *loop)
void | us_internal_loop_link (struct us_loop_t *loop, struct us_socket_context_t *context)
void | us_internal_loop_unlink (struct us_loop_t *loop, struct us_socket_context_t *context)
void | us_internal_timer_sweep (struct us_loop_t *loop)
void | us_internal_handle_low_priority_sockets (struct us_loop_t *loop)
void | us_internal_free_closed_sockets (struct us_loop_t *loop)
void | sweep_timer_cb (struct us_internal_callback_t *cb)
long long | us_loop_iteration_number (struct us_loop_t *loop)
void | us_internal_loop_pre (struct us_loop_t *loop)
void | us_internal_loop_post (struct us_loop_t *loop)
void | us_internal_dispatch_ready_poll (struct us_poll_t *p, int error, int events)
void | us_loop_integrate (struct us_loop_t *loop)
void * | us_loop_ext (struct us_loop_t *loop)

## Variables
static const int | MAX_LOW_PRIO_SOCKETS_PER_LOOP_ITERATION = 5

## Function Documentation

## ◆ sweep_timer_cb()

void sweep_timer_cb | ( | struct us_internal_callback_t * | cb | ) |

Definition at line 175 of file loop.c.

References us_internal_callback_t::loop, and us_internal_timer_sweep().

Referenced by us_loop_integrate().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ us_internal_dispatch_ready_poll()

void us_internal_dispatch_ready_poll | ( | struct us_poll_t * | p,
|  | int | error,
|  | int | events
| ) |  |

Definition at line 195 of file loop.c.

References bsd_accept_socket(), bsd_addr_get_ip(), bsd_addr_get_ip_length(), bsd_recv(), bsd_socket_nodelay(), bsd_would_block(), us_internal_callback_t::cb, us_socket_t::context, us_loop_t::data, us_socket_context_t::is_low_prio, us_internal_loop_data_t::last_write_failed, LIBUS_RECV_BUFFER_LENGTH, LIBUS_RECV_BUFFER_PADDING, LIBUS_SOCKET_DESCRIPTOR, LIBUS_SOCKET_ERROR, LIBUS_SOCKET_READABLE, LIBUS_SOCKET_WRITABLE, us_socket_t::long_timeout, us_socket_context_t::loop, us_internal_loop_data_t::low_prio_budget, us_internal_loop_data_t::low_prio_head, us_socket_t::low_prio_state, us_socket_t::next, us_socket_context_t::on_connect_error, us_socket_context_t::on_data, us_socket_context_t::on_end, us_socket_context_t::on_open, us_socket_context_t::on_writable, us_socket_t::p, us_internal_callback_t::p, POLL_TYPE_CALLBACK, POLL_TYPE_SEMI_SOCKET, POLL_TYPE_SOCKET, POLL_TYPE_SOCKET_SHUT_DOWN, us_socket_t::prev, us_internal_loop_data_t::recv_buf, us_listen_socket_t::s, us_listen_socket_t::socket_ext_size, us_socket_t::timeout, us_create_poll(), us_internal_accept_poll_event(), us_internal_poll_set_type(), us_internal_poll_type(), us_internal_socket_context_link_socket(), us_internal_socket_context_unlink_socket(), us_poll_change(), us_poll_events(), us_poll_fd(), us_poll_init(), us_poll_start(), us_socket_close(), us_socket_close_connecting(), us_socket_context(), us_socket_is_closed(), us_socket_is_shut_down(), and us_socket_timeout().

Here is the call graph for this function:

## ◆ us_internal_free_closed_sockets()

void us_internal_free_closed_sockets | ( | struct us_loop_t * | loop | ) |

Definition at line 163 of file loop.c.

References us_internal_loop_data_t::closed_head, us_loop_t::data, us_socket_t::next, and us_poll_free().

Referenced by us_internal_loop_post().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ us_internal_handle_low_priority_sockets()

void us_internal_handle_low_priority_sockets | ( | struct us_loop_t * | loop | ) |

Definition at line 143 of file loop.c.

References us_socket_t::context, us_loop_t::data, LIBUS_SOCKET_READABLE, us_internal_loop_data_t::low_prio_budget, us_internal_loop_data_t::low_prio_head, us_socket_t::low_prio_state, MAX_LOW_PRIO_SOCKETS_PER_LOOP_ITERATION, us_socket_t::next, us_socket_t::p, us_socket_t::prev, us_internal_socket_context_link_socket(), us_poll_change(), us_poll_events(), and us_socket_context().

Referenced by us_internal_loop_pre().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ us_internal_loop_data_free()

void us_internal_loop_data_free | ( | struct us_loop_t * | loop | ) |

Definition at line 42 of file loop.c.

References us_loop_t::data, us_internal_loop_data_t::recv_buf, us_internal_loop_data_t::sweep_timer, us_internal_async_close(), us_internal_free_loop_ssl_data(), us_timer_close(), and us_internal_loop_data_t::wakeup_async.

Here is the call graph for this function:

## ◆ us_internal_loop_data_init()

void us_internal_loop_data_init | ( | struct us_loop_t * | loop,
|  | void(*)(struct us_loop_t *loop) | wakeup_cb,
|  | void(*)(struct us_loop_t *loop) | pre_cb,
|  | void(*)(struct us_loop_t *loop) | post_cb
| ) |  |

Definition at line 23 of file loop.c.

References us_internal_loop_data_t::closed_head, us_loop_t::data, us_internal_loop_data_t::head, us_internal_loop_data_t::iteration_nr, us_internal_loop_data_t::iterator, LIBUS_RECV_BUFFER_LENGTH, LIBUS_RECV_BUFFER_PADDING, us_internal_loop_data_t::low_prio_budget, us_internal_loop_data_t::low_prio_head, us_internal_loop_data_t::post_cb, us_internal_loop_data_t::pre_cb, us_internal_loop_data_t::recv_buf, us_internal_loop_data_t::ssl_data, us_internal_loop_data_t::sweep_timer, us_create_timer(), us_internal_async_set(), us_internal_create_async(), and us_internal_loop_data_t::wakeup_async.

Here is the call graph for this function:

## ◆ us_internal_loop_link()

void us_internal_loop_link | ( | struct us_loop_t * | loop,
|  | struct us_socket_context_t * | context
| ) |  |

Definition at line 57 of file loop.c.

References us_loop_t::data, us_internal_loop_data_t::head, us_socket_context_t::next, and us_socket_context_t::prev.

Referenced by us_create_socket_context().

Here is the caller graph for this function:

## ◆ us_internal_loop_post()

void us_internal_loop_post | ( | struct us_loop_t * | loop | ) |

Definition at line 190 of file loop.c.

References us_loop_t::data, us_internal_loop_data_t::post_cb, and us_internal_free_closed_sockets().

Here is the call graph for this function:

## ◆ us_internal_loop_pre()

void us_internal_loop_pre | ( | struct us_loop_t * | loop | ) |

Definition at line 184 of file loop.c.

References us_loop_t::data, us_internal_loop_data_t::iteration_nr, us_internal_loop_data_t::pre_cb, and us_internal_handle_low_priority_sockets().

Here is the call graph for this function:

## ◆ us_internal_loop_unlink()

void us_internal_loop_unlink | ( | struct us_loop_t * | loop,
|  | struct us_socket_context_t * | context
| ) |  |

Definition at line 68 of file loop.c.

References us_loop_t::data, us_internal_loop_data_t::head, us_socket_context_t::next, and us_socket_context_t::prev.

Referenced by us_socket_context_free().

Here is the caller graph for this function:

## ◆ us_internal_timer_sweep()

void us_internal_timer_sweep | ( | struct us_loop_t * | loop | ) |

Definition at line 83 of file loop.c.

References us_socket_t::context, us_loop_t::data, us_socket_context_t::global_tick, us_internal_loop_data_t::head, us_socket_context_t::head_sockets, us_socket_context_t::iterator, us_internal_loop_data_t::iterator, us_socket_t::long_timeout, us_socket_context_t::long_timestamp, us_socket_t::next, us_socket_context_t::next, us_socket_context_t::on_socket_long_timeout, us_socket_context_t::on_socket_timeout, us_socket_t::timeout, and us_socket_context_t::timestamp.

Referenced by sweep_timer_cb().

Here is the caller graph for this function:

## ◆ us_loop_ext()

void * us_loop_ext | ( | struct us_loop_t * | loop | ) |

Definition at line 360 of file loop.c.

## ◆ us_loop_integrate()

void us_loop_integrate | ( | struct us_loop_t * | loop | ) |

Definition at line 356 of file loop.c.

References us_loop_t::data, LIBUS_TIMEOUT_GRANULARITY, us_internal_loop_data_t::sweep_timer, sweep_timer_cb(), and us_timer_set().

Here is the call graph for this function:

## ◆ us_loop_iteration_number()

long long us_loop_iteration_number | ( | struct us_loop_t * | loop | ) |

Definition at line 179 of file loop.c.

References us_loop_t::data, and us_internal_loop_data_t::iteration_nr.

## ◆ us_wakeup_loop()

void us_wakeup_loop | ( | struct us_loop_t * | loop | ) |

Definition at line 53 of file loop.c.

References us_loop_t::data, us_internal_async_wakeup(), and us_internal_loop_data_t::wakeup_async.

Here is the call graph for this function:

## Variable Documentation

## ◆ MAX_LOW_PRIO_SOCKETS_PER_LOOP_ITERATION

const int MAX_LOW_PRIO_SOCKETS_PER_LOOP_ITERATION = 5
| static

Definition at line 141 of file loop.c.

Referenced by us_internal_handle_low_priority_sockets().