diff options
-rw-r--r-- | announce.c | 13 | ||||
-rw-r--r-- | main.h | 1 | ||||
-rw-r--r-- | utils.h | 2 |
3 files changed, 8 insertions, 8 deletions
@@ -14,9 +14,7 @@ struct announce { uint64_t value; struct uring_task task; - struct uring_task mcast_task; - struct sockaddr_in mcast_addr; }; static void @@ -50,8 +48,8 @@ mcast_send(struct cfg *cfg, struct announce *aev, struct server *server) return; } - server->mcast_msg.msg_name = &aev->mcast_addr; - server->mcast_msg.msg_namelen = sizeof(aev->mcast_addr); + server->mcast_msg.msg_name = &aev->mcast_task.addr; + server->mcast_msg.msg_namelen = sizeof(aev->mcast_task.addr); server->mcast_iov.iov_len = len; uring_sendmsg(cfg, &aev->mcast_task, &server->mcast_msg, mcast_sent); @@ -181,10 +179,9 @@ announce_init(struct cfg *cfg) uring_task_init(&aev->mcast_task, "aev_mcast", &aev->task, mcast_free); uring_task_set_fd(&aev->mcast_task, sfd); - memset(&aev->mcast_addr, 0, sizeof(aev->mcast_addr)); - aev->mcast_addr.sin_family = AF_INET; - aev->mcast_addr.sin_addr.s_addr = inet_addr("224.0.2.60"); - aev->mcast_addr.sin_port = htons(4445); + aev->mcast_task.addr.in4.sin_family = AF_INET; + aev->mcast_task.addr.in4.sin_addr.s_addr = inet_addr("224.0.2.60"); + aev->mcast_task.addr.in4.sin_port = htons(4445); cfg->aev = aev; uring_read(cfg, &aev->task, &aev->value, sizeof(aev->value), announce_cb); @@ -44,6 +44,7 @@ struct uring_task { callback_t callback; rcallback_t complete_callback; /* to check if tbuf processing is done */ callback_t final_callback; /* once tbuf processing is done */ + struct sockaddr_in46 addr; /* used for recvmsg/sendmsg */ void *priv; }; @@ -4,6 +4,7 @@ #include <stdio.h> #include <stdbool.h> #include <stdlib.h> +#include <linux/if_packet.h> struct list_head { struct list_head *next; @@ -30,6 +31,7 @@ struct sockaddr_in46 { struct sockaddr_storage storage; struct sockaddr_in in4; struct sockaddr_in6 in6; + struct sockaddr_ll ll; }; socklen_t addrlen; struct list_head list; |