|
static void | _redis_connected (redisAsyncContext const *ac, UNUSED int status) |
| Called by hiredis to indicate the connection is live. More...
|
|
static void | _redis_disconnected (redisAsyncContext const *ac, UNUSED int status) |
| Called by hiredis to indicate the connection is dead. More...
|
|
static int | _redis_handle_free (fr_redis_handle_t *h) |
| Free the redis async context when the handle is freed. More...
|
|
static void | _redis_io_add_read (void *uctx) |
| Register FD for reads. More...
|
|
static void | _redis_io_add_write (void *uctx) |
| Register FD for writes. More...
|
|
static void | _redis_io_common (connection_t *conn, fr_redis_handle_t *h, bool read, bool write) |
| Deal with the method hiredis uses to register/unregister interest in a file descriptor. More...
|
|
static void | _redis_io_connection_close (UNUSED fr_event_list_t *el, void *h, UNUSED void *uctx) |
| Notification that the connection has errored and must be closed. More...
|
|
static connection_state_t | _redis_io_connection_shutdown (UNUSED fr_event_list_t *el, void *h, UNUSED void *uctx) |
| Gracefully signal that the connection should shutdown. More...
|
|
static void | _redis_io_del_read (void *uctx) |
| De-register FD for reads. More...
|
|
static void | _redis_io_del_write (void *uctx) |
| De-register FD for writes. More...
|
|
static void | _redis_io_free (void *uctx) |
| Handle freeing the redisAsyncContext. More...
|
|
static void | _redis_io_service_errored (UNUSED fr_event_list_t *el, int fd, UNUSED int flags, int fd_errno, void *uctx) |
| Redis FD errored - Automatically removes registered events. More...
|
|
static void | _redis_io_service_readable (UNUSED fr_event_list_t *el, int fd, UNUSED int flags, void *uctx) |
| Redis FD became readable. More...
|
|
static void | _redis_io_service_writable (UNUSED fr_event_list_t *el, int fd, UNUSED int flags, void *uctx) |
| Redis FD became writable. More...
|
|
| CC_NO_UBSAN (function) |
| Callback for the initialise state. More...
|
|
connection_t * | fr_redis_connection_alloc (TALLOC_CTX *ctx, fr_event_list_t *el, connection_conf_t const *conn_conf, fr_redis_io_conf_t const *io_conf, char const *log_prefix) |
| Allocate an async redis I/O connection. More...
|
|
redisAsyncContext * | fr_redis_connection_get_async_ctx (connection_t *conn) |
| Return the redisAsyncContext associated with the connection. More...
|
|
static int | fr_redis_io_setup (redisAsyncContext *ac, connection_t const *conn) |
| Configures async I/O callbacks for an existing redisAsyncContext. More...
|
|
Common functions for interacting with Redis via hiredis.
- Id
- 476aefdc5a50be87eb41c4af3de90d63bcfa9a3b
- Copyright
- 2019 The FreeRADIUS server project
-
2019 Network RADIUS SAS (legal.nosp@m.@net.nosp@m.workr.nosp@m.adiu.nosp@m.s.com)
- Author
- Arran Cudbard-Bell (a.cud.nosp@m.bard.nosp@m.b@fre.nosp@m.erad.nosp@m.ius.o.nosp@m.rg)
Definition in file io.c.
Notification that the connection has errored and must be closed.
This should be used to close the file descriptor. It is assumed that the file descriptor is invalid after this callback has been executed.
If this callback does not close the file descriptor, the server will leak file descriptors.
- Parameters
-
[in] | el | to remove event handlers from. |
[in] | h | to close. |
[in] | uctx | User context. |
Definition at line 407 of file io.c.
static void _redis_io_free |
( |
void * |
uctx | ) |
|
|
static |
Handle freeing the redisAsyncContext.
delRead and delWrite don't seem to be called when the redisAsyncContext is freed
As the IO events must be removed from the event loop before the FD is closed and as the IO events will only be automatically de-registered when when the fr_redis_handle_t is freed.
Unfortunately the destructor for the fr_redis_handle_t will be run before the IO events are de-registered, which'll free the redisAsycCtx, which'll close the FD.
This means there'd be a brief period of time between the FD is closed, and it being removed from the event loop.
We use the cleanup callback (which is called before the FD is closed) to remove the events now, and ensure there's no chance of issues.
Definition at line 248 of file io.c.