hop-2012/relay.c

46 lines
1.1 KiB
C

/* Copyright (C) 2010 Tony Garnock-Jones. All rights reserved. */
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <time.h>
#include <sys/time.h>
typedef unsigned char u_char;
#include <event.h>
#include "cmsg_private.h"
#include "harness.h"
#include "relay.h"
#include "net.h"
void start_relay(struct sockaddr_in const *peername, int fd) {
/*
connstate_t *conn = calloc(1, sizeof(connstate_t));
conn->peername = *peername;
conn->fd = fd;
conn->amqp_conn = amqp_new_connection();
amqp_set_sockfd(conn->amqp_conn, fd);
conn->io = bufferevent_new(fd,
(evbuffercb) read_callback,
NULL,
(everrorcb) error_callback,
conn);
bufferevent_settimeout(conn->io, PROTOCOL_HEADER_TIMEOUT, 0);
bufferevent_enable(conn->io, EV_READ | EV_WRITE);
conn->state = CONNECTION_STATE_INITIAL;
conn->vhost = NULL;
*/
info("Accepted connection from %s on fd %d\n", endpoint_name(peername), fd);
}