search for: connection_close_function

Displaying 20 results from an estimated 24 matches for "connection_close_function".

2020 Feb 11
1
Re: [PATCH nbdkit 1/3] server: Add GET_CONN macro, alias for threadlocal_get_conn ().
...er (size_t size); > extern void threadlocal_set_conn (struct connection *conn); > extern struct connection *threadlocal_get_conn (void); > +#define GET_CONN (threadlocal_get_conn ()) Do we want any checking, such as whether this is non-NULL? For example, patch 3 has: -typedef void (*connection_close_function) (struct connection *) __attribute__((__nonnull__ (1))); +typedef void (*connection_close_function) (void); which loses the compile-time checking that we have a non-NULL connection parameter; so replacing a parameter passed through a nonnull attribute with a macro that guarantees a nonnull r...
2019 Jun 06
0
[nbdkit PATCH 1/2] server: Add support for corking
...*, typedef int (*connection_send_function) (struct connection *, const void *buf, size_t len) __attribute__((__nonnull__ (1, 2))); +typedef int (*connection_cork_function) (struct connection *, bool) + __attribute__((__nonnull__ (1))); typedef void (*connection_close_function) (struct connection *) __attribute__((__nonnull__ (1))); @@ -180,6 +182,7 @@ struct connection { int sockin, sockout; connection_recv_function recv; connection_send_function send; + connection_cork_function cork; connection_close_function close; }; diff --git a/server/connections...
2019 Jan 02
0
[PATCH nbdkit v2 1/2] Annotate internal function parameters with attribute((nonnull)).
...25,44 @@ extern void cleanup_unlock (pthread_mutex_t **ptr); /* connections.c */ struct connection; -typedef int (*connection_recv_function) (struct connection *, void *buf, size_t len); -typedef int (*connection_send_function) (struct connection *, const void *buf, size_t len); -typedef void (*connection_close_function) (struct connection *); +typedef int (*connection_recv_function) (struct connection *, + void *buf, size_t len) + __attribute__((__nonnull__ (1, 2))); +typedef int (*connection_send_function) (struct connection *, + co...
2020 Feb 12
0
[PATCH nbdkit 2/3] server: Rename ‘struct b_conn_handle’ to plain ‘struct handle’.
...ns(+), 40 deletions(-) diff --git a/server/internal.h b/server/internal.h index c3622671..9d314bf8 100644 --- a/server/internal.h +++ b/server/internal.h @@ -170,16 +170,24 @@ typedef int (*connection_send_function) (const void *buf, size_t len, __attribute__((__nonnull__ (1))); typedef void (*connection_close_function) (void); +/* struct handle stores data per connection and backend. Primarily + * this is the filter or plugin handle, but other state is also stored + * here. + * + * Use get_handle (conn, 0) to return the struct handle for the + * plugin, and get_handle (conn, b->i) to return the struct hand...
2019 Jun 06
4
[nbdkit PATCH 0/2] Reduce network overhead with corking
Slightly RFC, as I need more time to investigate why Unix sockets appeared to degrade with this patch. But as TCP sockets (over loopback to localhost) and TLS sessions (regardless of underlying Unix or TCP) both showed improvements, this looks like a worthwhile series. Eric Blake (2): server: Add support for corking server: Cork around grouped transmission send()s server/internal.h | 3
2019 Jan 02
4
[PATCH nbdkit v2 0/2] Use of attribute(()).
v1 was here: https://www.redhat.com/archives/libguestfs/2019-January/msg00008.html In v2 I have provided two patches: The first patch extends attribute((nonnull)) to most internal functions, but not to the external API. The second patch uses a macro so that attribute((format)) is only used in the public API on GCC or Clang. At least in theory these headers could be used by a C compiler which
2019 Oct 07
0
[nbdkit PATCH 5/5] server: Ensure .finalize and .close are called as needed
...ize> forces the client to disconnect. =head2 C<.get_size> diff --git a/server/internal.h b/server/internal.h index eb0e30c1..167da59a 100644 --- a/server/internal.h +++ b/server/internal.h @@ -153,9 +153,17 @@ typedef int (*connection_send_function) (struct connection *, typedef void (*connection_close_function) (struct connection *) __attribute__((__nonnull__ (1))); +enum { + HANDLE_OPEN = 1, /* Set if .open passed, so .close is needed */ + HANDLE_CONNECTED = 2, /* Set if .prepare passed, so .finalize is needed */ + HANDLE_FAILED = 4, /* Set if .finalize failed */ +}; + struct b_conn_hand...
2019 Aug 30
0
[nbdkit PATCH 5/9] server: Cache per-connection size
....prepare>, you can +ensure that later calls during data commands like <.pread> will not +fail. =head2 C<.can_write> diff --git a/server/internal.h b/server/internal.h index 9bf84022..ec8a894c 100644 --- a/server/internal.h +++ b/server/internal.h @@ -151,7 +151,7 @@ typedef void (*connection_close_function) (struct connection *) struct b_conn_handle { void *handle; - // TODO add per-backend caching + uint64_t exportsize; }; struct connection { @@ -168,7 +168,6 @@ struct connection { size_t nr_handles; uint32_t cflags; - uint64_t exportsize; uint16_t eflags; bool readonly; b...
2018 Jan 17
0
[PATCH 5/9] connections: Allow multiple handles to be stored in the connection object.
...h b/src/internal.h index dc26665..5a68d59 100644 --- a/src/internal.h +++ b/src/internal.h @@ -131,8 +131,8 @@ typedef int (*connection_recv_function) (struct connection *, void *buf, size_t typedef int (*connection_send_function) (struct connection *, const void *buf, size_t len); typedef void (*connection_close_function) (struct connection *); extern int handle_single_connection (int sockin, int sockout); -extern void connection_set_handle (struct connection *conn, void *handle); -extern void *connection_get_handle (struct connection *conn); +extern int connection_set_handle (struct connection *conn, size_t i, vo...
2018 Jan 19
0
[nbdkit PATCH v2 08/13] connections: Allow multiple handles to be stored in the connection object.
...h b/src/internal.h index 9d01c2b..28b1aaf 100644 --- a/src/internal.h +++ b/src/internal.h @@ -134,8 +134,8 @@ typedef int (*connection_recv_function) (struct connection *, void *buf, size_t typedef int (*connection_send_function) (struct connection *, const void *buf, size_t len); typedef void (*connection_close_function) (struct connection *); extern int handle_single_connection (int sockin, int sockout); -extern void connection_set_handle (struct connection *conn, void *handle); -extern void *connection_get_handle (struct connection *conn); +extern int connection_set_handle (struct connection *conn, size_t i, vo...
2019 Mar 18
3
[PATCH nbdkit 0/2] server: Split out NBD protocol code from connections code.
These are a couple of patches in preparation for the Block Status implementation. While the patches (especially the second one) are very large they are really just elementary code motion. Rich.
2019 Nov 04
3
[PATCH nbdkit 0/3] server: Fix crash on close.
This fixes the long-standing crash on close when nbdkit exits. I did try first to fix threads so we're using a proper thread pool, but that's difficult to implement. So this does the minimal change needed to fix the crash instead. There are still two segfaults that happen during running the test suite. One is deliberately caused (tests/test-captive.sh). The other appears to be an
2017 Nov 17
8
[RFC nbdkit PATCH 0/6] Enable full parallel request handling
I want to make my nbd forwarding plugin fully parallel - but to do that, I first need to make nbdkit itself fully parallel ;) With this series, I was finally able to demonstrate out-of-order responses when using qemu-io (which is great at sending back-to-back requests prior to waiting for responses) coupled with the nbd file plugin (which has a great feature of rdelay and wdelay, to make it
2019 Jan 01
2
[PATCH nbdkit] server: Use bool for types which are really booleans.
...volatile int quit; extern int quit_fd; -extern int forked_into_background; +extern bool forked_into_background; extern struct backend *backend; #define for_each_backend(b) for (b = backend; b != NULL; b = b->next) @@ -140,7 +140,7 @@ extern void connection_set_close (struct connection *, connection_close_function /* crypto.c */ #define root_tls_certificates_dir sysconfdir "/pki/" PACKAGE_NAME -extern void crypto_init (int tls_set_on_cli); +extern void crypto_init (bool tls_set_on_cli); extern void crypto_free (void); extern int crypto_negotiate_tls (struct connection *conn, int sockin, int s...
2020 Feb 12
5
[PATCH nbdkit 1/3] server: Rename global backend pointer to "top".
It's confusing to use the same terminology for a single backend as for the linked list of backends. In particular it's often not clear if we're calling the next backend or the whole chain of backends. --- server/internal.h | 14 ++++++++++-- server/connections.c | 20 ++++++++--------- server/locks.c | 2 +- server/main.c
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
2020 Feb 11
5
[PATCH nbdkit 0/3] server: Remove explicit connection parameter.
The third patch is a large but mechanical change which gets rid of passing around struct connection * entirely within the server, preferring instead to reference the connection through thread-local storage. I hope this is a gateway to simplifying other parts of the code. Rich.
2019 Jun 07
4
[nbdkit PATCH v2 0/2] Reduce network overhead with MSG_MORE/corking
This time around, the numbers are indeed looking better than in v1; and I like the interface better. Eric Blake (2): server: Prefer send() over write() server: Group related transmission send()s server/internal.h | 7 +++- server/connections.c | 51 +++++++++++++++++++++++++--- server/crypto.c | 11 ++++--
2019 Oct 07
6
[nbdkit PATCH 0/5] More retry fixes
I think this is my last round of patches for issues I identified with the retry filter. With this in place, it should be safe to interject another filter in between retry and the plugin. Eric Blake (5): retry: Don't call into closed plugin tests: Refactor test-retry-reopen-fail.sh tests: Enhance retry test to cover failed reopen server: Move prepare/finalize/close recursion to
2020 Feb 11
0
[PATCH nbdkit 3/3] server: Remove explicit connection parameter, use TLS instead.
...*buf, size_t len, +typedef int (*connection_recv_function) (void *buf, size_t len) + __attribute__((__nonnull__ (1))); +typedef int (*connection_send_function) (const void *buf, size_t len, int flags) - __attribute__((__nonnull__ (1, 2))); -typedef void (*connection_close_function) (struct connection *) __attribute__((__nonnull__ (1))); +typedef void (*connection_close_function) (void); enum { HANDLE_OPEN = 1, /* Set if .open passed, so .close is needed */ @@ -234,29 +231,22 @@ struct connection { }; extern void handle_single_connection (int sockin, int soc...