From: alex Date: Thu, 5 May 2022 01:42:40 +0000 (-0700) Subject: ... X-Git-Url: http://git.infiniteadaptability.org/?a=commitdiff_plain;h=ccb6c9b9b63b6cedecfa532b8790246f1c395c43;p=seeder ... --- diff --git a/src/net/loop.c b/src/net/loop.c index 0ee81bf..9770436 100644 --- a/src/net/loop.c +++ b/src/net/loop.c @@ -13,6 +13,7 @@ void net_loop(struct net_info *info) { static void net_await_epoll_event(struct net_info *info) { struct epoll_event ev, events[MAX_EVENTS]; + struct peer *peer; int nfds, conn_sock; nfds = epoll_wait(info->epoll_fd,events,MAX_EVENTS,-1); @@ -34,11 +35,12 @@ static void net_await_epoll_event(struct net_info *info) { ev.events = EPOLLIN | EPOLLET; ev.data.fd = conn_sock; - if(peer_init((struct peer**)ev.data.ptr)<0) { + if(peer_init(&peer)<0) { return; } - ((struct peer*)ev.data.ptr)->sock = conn_sock; + peer->sock = conn_sock; + ev.data.ptr = peer; if(-1==epoll_ctl(info->epoll_fd,EPOLL_CTL_ADD,conn_sock,&ev)) { peer_free(ev.data.ptr);