[glib/wip/tingping/happy-eyeballs: 3/3] gsocketaddressenumerator: Make it an error to call next_async before finish



commit 4c472f8e3fe6610d32766cfa4750edd4b82bd0b3
Author: Patrick Griffis <pgriffis igalia com>
Date:   Tue Dec 11 10:10:10 2018 -0500

    gsocketaddressenumerator: Make it an error to call next_async before finish
    
    It logically doesn't make sense to repeatedly call next_async()
    before the previous one has finished.

 gio/gnetworkaddress.c          | 4 ++++
 gio/gsocketaddressenumerator.c | 2 ++
 2 files changed, 6 insertions(+)
---
diff --git a/gio/gnetworkaddress.c b/gio/gnetworkaddress.c
index 035e18d42..1651f89ed 100644
--- a/gio/gnetworkaddress.c
+++ b/gio/gnetworkaddress.c
@@ -1271,6 +1271,10 @@ g_network_address_address_enumerator_next_async (GSocketAddressEnumerator  *enum
             complete_queued_task (addr_enum, task, NULL);
           else
             {
+              /* It does not make sense for this to be called multiple
+               * times before the initial callback has been called */
+              g_assert (addr_enum->queued_task == NULL);
+
               addr_enum->queued_task = g_steal_pointer (&task);
               /* Lookup in parallel as per RFC 8305 */
               g_resolver_lookup_by_name_with_flags_async (resolver,
diff --git a/gio/gsocketaddressenumerator.c b/gio/gsocketaddressenumerator.c
index 9e3942ffe..7986f342c 100644
--- a/gio/gsocketaddressenumerator.c
+++ b/gio/gsocketaddressenumerator.c
@@ -120,6 +120,8 @@ g_socket_address_enumerator_real_next_async (GSocketAddressEnumerator *enumerato
  * Asynchronously retrieves the next #GSocketAddress from @enumerator
  * and then calls @callback, which must call
  * g_socket_address_enumerator_next_finish() to get the result.
+ *
+ * It is an error to call this multiple times before the previous callback has finished.
  */
 void
 g_socket_address_enumerator_next_async (GSocketAddressEnumerator *enumerator,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]