Beispiel #1
0
void
connection_init (connection_t * connection, config_t * config)
{
  memset (connection, 0, sizeof (*connection));
  connection->config = config;
  LLIST_INIT (&connection->cmd_out, msg_t, CONNECTION_QUEUE_SIZE);
  connection->ref_count = 0;
  pthread_mutex_init (&connection->mutex, NULL);
  pthread_cond_init (&connection->cond, NULL);
}
Beispiel #2
0
#if defined(_WIN32) /*[*/
    HANDLE event;
#endif /*]*/
    void *dhandle;	/* httpd protocol handle */
    int idle;
    ioid_t ioid;	/* AddInput ID */
    ioid_t toid;	/* AddTimeOut ID */

    struct {		/* pending command state: */
	sendto_callback_t *callback; /* callback function */
	content_t content_type; /* content type */
	varbuf_t result; /* accumulated result data */
	bool done;	/* is the command done? */
    } pending;
} session_t;
llist_t sessions = LLIST_INIT(sessions);
static int n_sessions;
static socket_t listen_s;
#if defined(_WIN32) /*[*/
static HANDLE listen_event;
#endif /*]*/

/**
 * Return the text for the most recent socket error.
 *
 * @return Error text
 */
static const char *
socket_errtext(void)
{
#if !defined(_WIN32) /*[*/