LCOV - code coverage report
Current view: top level - src - server.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 24 24 100.0 %
Date: 2016-12-21 11:14:47 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /* server.c - Interfaces for all assuan servers.
       2             :    Copyright (C) 2009 Free Software Foundation, Inc.
       3             : 
       4             :    This file is part of Assuan.
       5             : 
       6             :    Assuan is free software; you can redistribute it and/or modify it
       7             :    under the terms of the GNU Lesser General Public License as
       8             :    published by the Free Software Foundation; either version 2.1 of
       9             :    the License, or (at your option) any later version.
      10             : 
      11             :    Assuan is distributed in the hope that it will be useful, but
      12             :    WITHOUT ANY WARRANTY; without even the implied warranty of
      13             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      14             :    Lesser General Public License for more details.
      15             : 
      16             :    You should have received a copy of the GNU Lesser General Public
      17             :    License along with this program; if not, see <http://www.gnu.org/licenses/>.
      18             :  */
      19             : 
      20             : 
      21             : #ifdef HAVE_CONFIG_H
      22             : #include <config.h>
      23             : #endif
      24             : 
      25             : #include "assuan-defs.h"
      26             : #include "debug.h"
      27             : 
      28             : 
      29             : 
      30             : /* Disconnect and release the context CTX.  */
      31             : void
      32           4 : _assuan_server_finish (assuan_context_t ctx)
      33             : {
      34           4 :   if (ctx->inbound.fd != ASSUAN_INVALID_FD)
      35             :     {
      36           2 :       _assuan_close (ctx, ctx->inbound.fd);
      37           2 :       if (ctx->inbound.fd == ctx->outbound.fd)
      38           1 :         ctx->outbound.fd = ASSUAN_INVALID_FD;
      39           2 :       ctx->inbound.fd = ASSUAN_INVALID_FD;
      40             :     }
      41           4 :   if (ctx->outbound.fd != ASSUAN_INVALID_FD)
      42             :     {
      43           1 :       _assuan_close (ctx, ctx->outbound.fd);
      44           1 :       ctx->outbound.fd = ASSUAN_INVALID_FD;
      45             :     }
      46           4 :   if (ctx->pid != ASSUAN_INVALID_PID && ctx->pid)
      47             :     {
      48           2 :       _assuan_waitpid (ctx, ctx->pid, ctx->flags.no_waitpid, NULL, 0);
      49           2 :       ctx->pid = ASSUAN_INVALID_PID;
      50             :     }
      51             : 
      52           4 :   _assuan_uds_deinit (ctx);
      53             : 
      54           4 :   _assuan_inquire_release (ctx);
      55           4 : }
      56             : 
      57             : 
      58             : void
      59           2 : _assuan_server_release (assuan_context_t ctx)
      60             : {
      61           2 :   _assuan_server_finish (ctx);
      62             : 
      63           2 :   _assuan_free (ctx, ctx->hello_line);
      64           2 :   ctx->hello_line = NULL;
      65           2 :   _assuan_free (ctx, ctx->okay_line);
      66           2 :   ctx->okay_line = NULL;
      67           2 :   _assuan_free (ctx, ctx->cmdtbl);
      68           2 :   ctx->cmdtbl = NULL;
      69           2 : }

Generated by: LCOV version 1.12