summaryrefslogtreecommitdiffstats
path: root/src/fastd.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-11-02 08:56:54 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-11-02 08:56:54 +0100
commit74b73a980b91799843f8004edd90387ac482af46 (patch)
tree837a5eadf2ab3316168f5ebf4cca954b232034cb /src/fastd.c
parentcb98cbc593309d4781dfb873b018a5d4e12ad118 (diff)
downloadfastd-74b73a980b91799843f8004edd90387ac482af46.tar
fastd-74b73a980b91799843f8004edd90387ac482af46.zip
Keep track of corresonding peers in associated sockets
Diffstat (limited to 'src/fastd.c')
-rw-r--r--src/fastd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/fastd.c b/src/fastd.c
index ec33356..1d74cb3 100644
--- a/src/fastd.c
+++ b/src/fastd.c
@@ -152,7 +152,7 @@ static void init_sockets(fastd_context *ctx) {
unsigned i;
fastd_bind_address *addr = ctx->conf->bind_addrs;
for (i = 0; i < ctx->conf->n_bind_addrs; i++) {
- ctx->socks[i] = (fastd_socket){-2, addr};
+ ctx->socks[i] = (fastd_socket){-2, addr, NULL};
if (addr == ctx->conf->bind_addr_default_v4)
ctx->sock_default_v4 = &ctx->socks[i];
@@ -256,7 +256,7 @@ static void bind_sockets(fastd_context *ctx) {
}
}
-fastd_socket* fastd_socket_open(fastd_context *ctx, int af) {
+fastd_socket* fastd_socket_open(fastd_context *ctx, const fastd_peer *peer, int af) {
const fastd_bind_address any_address = { .addr.sa.sa_family = af };
int fd = bind_socket(ctx, &any_address, true);
@@ -267,6 +267,7 @@ fastd_socket* fastd_socket_open(fastd_context *ctx, int af) {
sock->fd = fd;
sock->addr = NULL;
+ sock->peer = peer;
return sock;
}