search for: accept_connect

Displaying 20 results from an estimated 27 matches for "accept_connect".

2017 Nov 16
0
Re: [PATCH 0/3] Alternate way to avoid race conditions when nbdkit exits.
...solves that SEGV, but using both seems like a good idea). We also have a race that results in a hang in sockets.c:accept_incoming_connections(); if I understand the problem, it is something like: main signal context -------------------------------------- first iteration, finish accept_connect() checks !quit, starts second iteration SIGTERM received set quit call poll() which hangs trying to connect to the socket, compared to the usual: main signal context -------------------------------------- first iteration, finish...
2020 Apr 28
2
[PATCH nbdkit] server/locks: Allow lock_request to be called when there is no current conn.
On Haiku tests/test-socket-activation failed with: nbdkit: locks.c:96:lock_request: conn != NULL called from server/sockets.c: accept_connection in the fallback path which does: lock_request (); thread_data->sock = set_cloexec (accept (listen_sock, NULL, NULL)); unlock_request () Because there is no current connection in this thread this code fails. However it should be possible to call lock_request without a connection, provi...
2017 Nov 14
7
[PATCH 0/3] Alternate way to avoid race conditions when nbdkit exits.
This fixes the race conditions for me, using the test described here: https://www.redhat.com/archives/libguestfs/2017-September/msg00226.html Rich.
2017 Mar 03
2
[PATCH 1/2] Use gnulib set_nonblocking_flag function instead of fcntl.
...ket.c index 4e1f781..2cd261a 100644 --- a/lib/conn-socket.c +++ b/lib/conn-socket.c @@ -37,6 +37,7 @@ #include <libintl.h> #include "ignore-value.h" +#include "nonblocking.h" #include "guestfs.h" #include "guestfs-internal.h" @@ -129,8 +130,8 @@ accept_connection (guestfs_h *g, struct connection *connv) conn->daemon_sock = sock; /* Make sure the new socket is non-blocking. */ - if (fcntl (conn->daemon_sock, F_SETFL, O_NONBLOCK) == -1) { - perrorf (g, "accept_connection: fcntl"); + if (set_nonblocking_flag (conn->daemon_soc...
2014 Feb 13
3
Libguestfs (1.22.6) driver/changes for mingw/win32
Hi, I attached the changes I made to a vanilla libguestfs-1.22.6 in order to make it work in mingw/win32. Added is also the patch required to make QEMU compatible (add a command to QMP that lists the supported devices (the regilat way you do it print it to stderr, which is difficult to redirect in win32)). This is done on behalf of Intel Corp. Thanks, Or (oberon in irc)
2017 Nov 17
0
[nbdkit PATCH 4/4] sockets: Fix lifetime of thread_data
...+), 9 deletions(-) diff --git a/src/sockets.c b/src/sockets.c index edb63b3..1d63523 100644 --- a/src/sockets.c +++ b/src/sockets.c @@ -261,6 +261,7 @@ start_thread (void *datav) handle_single_connection (data->sock, data->sock); + free (data); return NULL; } @@ -270,18 +271,25 @@ accept_connection (int listen_sock) int err; pthread_attr_t attrs; pthread_t thread; - struct thread_data thread_data; + struct thread_data *thread_data; static size_t instance_num = 1; - thread_data.instance_num = instance_num++; - thread_data.addrlen = sizeof thread_data.addr; + thread_data =...
2019 May 30
0
[PATCH nbdkit 2/2] server: Disable Nagle's algorithm.
...de <sys/socket.h> #include <sys/un.h> +#include <netinet/in.h> +#include <netinet/tcp.h> #include <netdb.h> -#include <poll.h> -#include <errno.h> -#include <assert.h> #ifdef HAVE_LIBSELINUX #include <selinux/selinux.h> @@ -273,6 +275,7 @@ accept_connection (int listen_sock) pthread_t thread; struct thread_data *thread_data; static size_t instance_num = 1; + const int flag = 1; thread_data = malloc (sizeof *thread_data); if (!thread_data) { @@ -293,6 +296,11 @@ accept_connection (int listen_sock) return; } + /* Disable...
2019 May 30
2
[PATCH nbdkit 1/2] nbd: Fix -Werror=maybe-uninitialized warning.
GCC is concerned that if we never go round the loop then fd will be uninitialized. By asserting that getaddrinfo set result != NULL we can avoid this. nbd.c: In function ‘nbd_open_handle’: nbd.c:974:5: error: ‘fd’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 974 | close (fd); | ^~~~~~~~~~ nbd.c:954:7: note: ‘fd’ was declared here 954 | int fd;
2013 Mar 07
3
[PATCH 0/3] protocol: Abstract out socket operations.
I've been taking a long hard look at the protocol layer. It has evolved over a long time without any particular direction, and the result is, to say the least, not very organized. These patches take a first step at cleaning up the mess by abstracting out socket operations from the rest of the code. The purpose of this is to allow us to slot in a different connection layer under the
2019 Sep 18
1
[PATCH nbdkit] server: Remove useless thread local sockaddr.
...thread (void *datav) /* Set thread-local data. */ threadlocal_new_server_thread (); threadlocal_set_instance_num (data->instance_num); - threadlocal_set_sockaddr (&data->addr, data->addrlen); handle_single_connection (data->sock, data->sock); @@ -299,12 +296,9 @@ accept_connection (int listen_sock) } thread_data->instance_num = instance_num++; - thread_data->addrlen = sizeof thread_data->addr; again: #ifdef HAVE_ACCEPT4 - thread_data->sock = accept4 (listen_sock, - &thread_data->addr, &thread_data->addrl...
2019 Nov 02
2
[PATCH nbdkit] server: Use GCC hints to move debug and error handling code out of hot paths.
...quot; PRIu32 " type %" PRIu32, + blocks[i].length, blocks[i].status_flags); #endif /* Convert to big endian for the protocol. */ diff --git a/server/sockets.c b/server/sockets.c index 1585a09..119cb99 100644 --- a/server/sockets.c +++ b/server/sockets.c @@ -365,7 +365,7 @@ accept_connection (int listen_sock) const int flag = 1; thread_data = malloc (sizeof *thread_data); - if (!thread_data) { + if (unlikely (!thread_data)) { perror ("malloc"); return; } @@ -409,7 +409,7 @@ accept_connection (int listen_sock) pthread_attr_setdetachstate (&attr...
2019 Sep 05
2
[PATCH nbdkit] Ban use of stack Variable Length Arrays (VLAs).
...;rm -rf %s", tmpdir); - system (cmd); + if (asprintf (&cmd, "rm -rf %s", tmpdir) >= 0) + system (cmd); free (script); } diff --git a/server/sockets.c b/server/sockets.c index 26d65c6..dfaa3ea 100644 --- a/server/sockets.c +++ b/server/sockets.c @@ -366,10 +366,16 @@ accept_connection (int listen_sock) static void check_sockets_and_quit_fd (int *socks, size_t nr_socks) { - struct pollfd fds[nr_socks + 1]; size_t i; int r; + CLEANUP_FREE struct pollfd *fds = + malloc (sizeof (struct pollfd) * (nr_socks+1)); + if (fds == NULL) { + perror ("malloc")...
2017 Nov 17
7
[nbdkit PATCH 0/4] thread-safety issues prior to parallel handling
These patches should be ready to go in now; I will also post my work-in-progress for enabling full parallel handling that depends on these, but with that series, I was still getting crashes or hangs with test-socket-activation (I think I've nailed all the crashes I've seen, but the hang is rather insidious; see my other email
2020 Apr 28
0
Re: [PATCH nbdkit] server/locks: Allow lock_request to be called when there is no current conn.
On 4/28/20 11:45 AM, Richard W.M. Jones wrote: > On Haiku tests/test-socket-activation failed with: > > nbdkit: locks.c:96:lock_request: conn != NULL > > called from server/sockets.c: accept_connection > in the fallback path which does: > lock_request (); > thread_data->sock = set_cloexec (accept (listen_sock, NULL, NULL)); > unlock_request () > > Because there is no current connection in this thread this code fails. > > However it should be possible to ca...
2019 Sep 05
0
Re: [PATCH nbdkit] Ban use of stack Variable Length Arrays (VLAs).
...l metacharacters (your patch does not change that fact). If we ever decided to honor $TMPDIR (that is, creating $TMPDIR/nbdkitshXXXXXX instead of /tmp/nbdkitshXXXXXX), then we'd need shell quoting here. But doesn't change this patch. > +++ b/server/sockets.c > @@ -366,10 +366,16 @@ accept_connection (int listen_sock) > static void > check_sockets_and_quit_fd (int *socks, size_t nr_socks) > { > - struct pollfd fds[nr_socks + 1]; > size_t i; > int r; > > + CLEANUP_FREE struct pollfd *fds = > + malloc (sizeof (struct pollfd) * (nr_socks+1)); This is...
2019 Jan 14
6
[PATCH nbdkit incomplete 0/5] Port to Windows.
This is an incomplete port to Windows. Currently the server compiles and starts up successfully, but goes into an infinite loop when you connect to it. Nevertheless I think the approach is ready for feedback. This being Windows the changes go quite deep. Rich.
2016 Mar 23
2
Re: [PATCH v3 05/11] conn: Pretend to be a serial terminal, so sgabios doesn't hang.
...Send it upwards. */ > guestfs_int_log_message_callback (g, buf, n); > > return 1; If I read this correctly, the newly added memmem would be executed for every read data from the daemon socket: read_data -> handle_log_message -> memmem Wouldn't be better to limit it in accept_connection if possible? More than the overhead of memmem, I'm worried that this check might misdetect other kind of binary data coming from the daemon (e.g. download APIs) with the sgabios output. -- Pino Toscano
2008 Jun 06
1
Unexpected NameError when invoking task on worker
...ms/1.8/gems/packet-0.1.5/lib/packet/packet_connection.rb:21:in `invoke_init'' from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/packet_core.rb:302:in `decorate_handler'' from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/packet_core.rb:76:in `accept_connection'' from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/packet_core.rb:202:in `handle_external_messages'' from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/packet_core.rb:178:in `handle_read_event'' from /opt/local/lib/ruby/ge...
2012 Jan 25
26
[PATCH v4 00/23] Xenstore stub domain
Changes from v3: - mini-os configuration files moved into stubdom/ - mini-os extra console support now a config option - Fewer #ifdefs - grant table setup uses hypercall bounce - Xenstore stub domain syslog support re-enabled Changes from v2: - configuration support added to mini-os build system - add mini-os support for conditionally compiling frontends, xenbus -
2017 Nov 20
10
[nbdkit PATCH v2 0/8] Support parallel transactions within single connection
I've posted some of these patches or ideas before; but now I'm confident enough with the series that it should be ready to push; at any rate, I can now run test-socket-activation in a tight loop without triggering any crashes or hangs. With this in place, I'm going back to work on making the nbd forwarder wort with the parallel thread model. Eric Blake (8): sockets: Use