#include <assert.h>#include <errno.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/param.h>#include <sys/select.h>#include <sys/socket.h>#include <sys/time.h>#include <sys/types.h>#include <sys/uio.h>#include <time.h>#include <unistd.h>#include <atalk/cnid_bdb_private.h>#include <atalk/compat.h>#include <atalk/logger.h>#include <atalk/util.h>#include "db_param.h"#include "usockfd.h"#include "comm.h"Data Structures | |
| struct | connection |
Macros | |
| #define | USE_WRITEV |
Functions | |
| static void | invalidate_fd (int fd) |
| static int | check_fd (time_t timeout, const sigset_t *sigmask, time_t *now) |
| Check for client requests. | |
| int | comm_init (struct db_param *dbp, int ctrlfd, int clntfd) |
| int | comm_nbe (void) |
| int | comm_rcv (struct cnid_dbd_rqst *rqst, time_t timeout, const sigset_t *sigmask, time_t *now) |
| int | comm_snd (struct cnid_dbd_rply *rply) |
Variables | |
| static int | control_fd |
| static int | cur_fd |
| static struct connection * | fd_table |
| static int | fd_table_size |
| static int | fds_in_use = 0 |
| #define USE_WRITEV |
|
static |
Check for client requests.
We keep up to fd_table_size open descriptors in fd_table. If the table is full and we get a new descriptor via control_fd, we close a random decriptor in the table to make space. The affected client will automatically reconnect. For an EOF (descriptor is closed by the client, so a read here returns 0) comm_rcv will take care of things and clean up fd_table. The same happens for any read/write errors.
| int comm_init | ( | struct db_param * | dbp, |
| int | ctrlfd, | ||
| int | clntfd ) |
| int comm_nbe | ( | void | ) |
| int comm_rcv | ( | struct cnid_dbd_rqst * | rqst, |
| time_t | timeout, | ||
| const sigset_t * | sigmask, | ||
| time_t * | now ) |
| int comm_snd | ( | struct cnid_dbd_rply * | rply | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |