On 01/15/2018 11:35 AM, Erik Skultety wrote:
On Wed, Jan 10, 2018 at 12:23:28PM -0500, John Ferlan wrote:
> Rather than waiting until virNetServerDispose to toggle the service
> to off, let's do that when virNetServerServiceClose is called such
> as during virNetServerClose.
>
> Signed-off-by: John Ferlan <jferlan(a)redhat.com>
> ---
> src/rpc/virnetserver.c | 3 ---
> src/rpc/virnetserverservice.c | 2 ++
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
> index 77a4c0b8d..7bab11efb 100644
> --- a/src/rpc/virnetserver.c
> +++ b/src/rpc/virnetserver.c
> @@ -805,9 +805,6 @@ void virNetServerDispose(void *obj)
>
> VIR_FREE(srv->name);
>
> - for (i = 0; i < srv->nservices; i++)
> - virNetServerServiceToggle(srv->services[i], false);
> -
^This hunk would suffice.
> virThreadPoolFree(srv->workers);
>
> for (i = 0; i < srv->nservices; i++)
> diff --git a/src/rpc/virnetserverservice.c b/src/rpc/virnetserverservice.c
> index 4e5426ffe..636c5be4e 100644
> --- a/src/rpc/virnetserverservice.c
> +++ b/src/rpc/virnetserverservice.c
> @@ -525,4 +525,6 @@ void virNetServerServiceClose(virNetServerServicePtr svc)
> virNetSocketClose(svc->socks[i]);
> virObjectUnref(svc);
> }
> +
> + virNetServerServiceToggle(svc, false);
^This is a NOP, since all the sockets have been closed already (in the loop
which precedes the call) and the IO callback handle removed with watch reset to
-1.
oh right <facepalm>... and it was discussed multiple times in various
threads in the "other" series that I pulled this from...
I was more focused on trying to put together 3 or 4 disjoint series and
discussions into one pile and really wasn't thinking beyond the take
existing code or words and generate patches.
So, I'll drop the second hunk and change the commit message to:
netserver: Remove ServiceToggle during ServerDispose
No sense in calling ServiceToggle for all nservices during
ServiceDispose since ServerClose calls ServiceClose which
removes the IOCallback that's being toggled via ServiceToggle.
Tks -
John
Reviewed-by: Erik Skultety <eskultet(a)redhat.com>