--- src/remote/remote_driver.c | 5 +++++ src/rpc/virnetclient.c | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 885120e..711143a 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1027,6 +1027,11 @@ doRemoteClose(virConnectPtr conn, struct private_data *priv) (xdrproc_t) xdr_void, (char *) NULL) == -1) ret = -1; + /* this is needed so that the remote side has the time to close the socket */ + printf("\n\n DEBUG: Connection close called, sleeping\n\n"); + sleep(1); + printf("\n\n DEBUG: Finishing close\n\n"); + #ifdef WITH_GNUTLS virObjectUnref(priv->tls); priv->tls = NULL; diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 010c5c3..51b80a2 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -674,8 +674,15 @@ virNetClientCloseLocked(virNetClientPtr client) virKeepAliveStop(ka); virObjectUnref(ka); } - if (closeCb) + if (closeCb) { + /* the callback has to delay for a while until the connection object + * is being freed in the original thread that closed the connection + * */ + printf("\n\n DEBUG: calling the close callback\n\n"); + sleep(2); closeCb(client, closeReason, closeOpaque); + printf("\n\n DEBUG: callback returned\n\n"); + } virObjectLock(client); virObjectUnref(client); -- 1.8.1.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list