gio/tests: Prevent hangs and aborts in socket-listener
gio/tests: Prevent hangs and aborts in socket-listener

Fix two problems:
1) If g_socket_service_stop is called before the accept call is requeued,
then the reference count won't decrease and this code will hang forever:
  while (G_OBJECT (service)->ref_count == ref_count)
    g_main_context_iteration (NULL, TRUE);

2) Sometimes the testcase fails (maybe 1 in 200 times for me):
GLib-GIO:ERROR:socket-listener.c:73:connection_cb: assertion failed
(G_OBJECT (service)->ref_count == 2): (3 == 2)
Aborted (core dumped)

The problem is that depending on ordering, cancellation of the async
listener can require further main context iterations before it releases
the reference on the socket service. Furthermore, in some cases, it
requires at least one iteration.

https://bugzilla.gnome.org/show_bug.cgi?id=712570

tchakabam/glib,gale320/glib,cention-sany/glib,Distrotech/glib,lukasz-skalski/glib,lukasz-skalski/glib,Distrotech/glib,krichter722/glib,johne53/MB3Glib,mzabaluev/glib,tchakabam/glib,johne53/MB3Glib,lukasz-skalski/glib,mzabaluev/glib,ieei/glib,endlessm/glib,gale320/glib,cention-sany/glib,endlessm/glib,johne53/MB3Glib,tchakabam/glib,krichter722/glib,gale320/glib,johne53/MB3Glib,gale320/glib,mzabaluev/glib,tamaskenez/glib,endlessm/glib,ieei/glib,ieei/glib,tchakabam/glib,mzabaluev/glib,krichter722/glib,mzabaluev/glib,cention-sany/glib,cention-sany/glib,endlessm/glib,MathieuDuponchelle/glib,tamaskenez/glib,Distrotech/glib,Distrotech/glib,gale320/glib,tamaskenez/glib,ieei/glib,krichter722/glib,MathieuDuponchelle/glib,MathieuDuponchelle/glib,lukasz-skalski/glib,MathieuDuponchelle/glib,lukasz-skalski/glib,Distrotech/glib,endlessm/glib,krichter722/glib,tchakabam/glib,tamaskenez/glib,johne53/MB3Glib,MathieuDuponchelle/glib,cention-sany/glib,johne53/MB3Glib,ieei/glib,tamaskenez/glib