plugins/nbd/nbd.c
/* Free up the per-connection handle. */
Free up the per-connection handle.
Free up the per - connection handle .
static void
nbd_close (void *handle)
{
  struct handle *h = handle;
  if (!h->dead) {
    nbd_request_raw (h, 0, NBD_CMD_DISC, 0, 0, 0, NULL);
    shutdown (h->fd, SHUT_WR);
  }
  if ((errno = pthread_join (h->reader, NULL)))
    nbdkit_debug ("failed to join reader thread: %m");
  close (h->fd);
  pthread_mutex_destroy (&h->write_lock);
  pthread_mutex_destroy (&h->trans_lock);
  free (h);
}
static void nbd_close ( void * handle ) { struct handle * h = handle ; if ( ! h -> dead ) { nbd_request_raw ( h , 0 , NBD_CMD_DISC , 0 , 0 , 0 , NULL ) ; shutdown ( h -> fd , SHUT_WR ) ; } if ( ( errno = pthread_join ( h -> reader , NULL ) ) ) nbdkit_debug ( " " ) ; close ( h -> fd ) ; pthread_mutex_destroy ( & h -> write_lock ) ; pthread_mutex_destroy ( & h -> trans_lock ) ; free ( h ) ; }
Free up the per-connection handle.
Free up the per - connection handle .