mirror of
https://passt.top/passt
synced 2025-06-13 02:55:34 +02:00
passt, tap: Daemonise once socket is ready without waiting for connection
The existing behaviour is not really practical: an automated agent in charge of starting both qemu and passt would need to fork itself to start passt, because passt won't fork to background until qemu connects, and the agent needs to unblock to start qemu. Instead of waiting for a connection to daemonise, do it right away as soon as a socket is available: that can be considered an initialised state already. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
b1f5688495
commit
34e6429235
4 changed files with 51 additions and 21 deletions
6
passt.c
6
passt.c
|
@ -345,6 +345,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
sock_probe_mem(&c);
|
||||
|
||||
c.fd_tap = c.fd_tap_listen = -1;
|
||||
tap_sock_init(&c);
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
@ -387,9 +388,10 @@ loop:
|
|||
|
||||
for (i = 0; i < nfds; i++) {
|
||||
union epoll_ref ref = *((union epoll_ref *)&events[i].data.u64);
|
||||
int fd = events[i].data.fd;
|
||||
|
||||
if (events[i].data.fd == c.fd_tap)
|
||||
tap_handler(&c, events[i].events, &now);
|
||||
if (fd == c.fd_tap || fd == c.fd_tap_listen)
|
||||
tap_handler(&c, fd, events[i].events, &now);
|
||||
else
|
||||
sock_handler(&c, ref, events[i].events, &now);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue