Displaying 3 results from an estimated 3 matches for "connecting_callback".
2019 Jul 17
1
Re: [PATCH libnbd] examples: Include an example of integrating with the glib main loop.
...of the created state (which means
> + * that it first has a socket associated with it) we must initialize
> + * and register the pollfd.
> + */
> + if (!source->poll_registered && !nbd_aio_is_created (source->nbd)) {
> + int fd;
> +
> + if (source->connecting_callback) {
> + DEBUG (source, "calling connecting_callback");
> + source->connecting_callback (source);
> + }
If I understand nbd_aio_connect_tcp properly, there are cases where we
end up trying several options presented from getaddrinfo() with a
possible reset back to S...
2019 Jul 15
2
[PATCH libnbd] examples: Include an example of integrating with the glibc main loop.
** NOT WORKING **
This patch shows how to integrate libnbd and the glib main loop.
Posted mainly as a point of discussion as it doesn't quite work yet.
Rich.
2019 Jul 15
0
[PATCH libnbd] examples: Include an example of integrating with the glib main loop.
...ebugging, do:
+ *
+ * LIBNBD_DEBUG=1 ./examples/glib-main-loop
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <assert.h>
+
+#include <libnbd.h>
+
+#include <glib.h>
+
+struct NBDSource;
+typedef void (*connecting_callback_t) (struct NBDSource *);
+typedef void (*connected_callback_t) (struct NBDSource *);
+
+/* This is the derived GSource type. */
+struct NBDSource {
+ /* The base type. This MUST be the first element in this struct. */
+ GSource source;
+
+ /* The underlying libnbd handle. */
+ struct nbd_handl...