• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GNUNET_free_non_null函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GNUNET_free_non_null函数的典型用法代码示例。如果您正苦于以下问题:C++ GNUNET_free_non_null函数的具体用法?C++ GNUNET_free_non_null怎么用?C++ GNUNET_free_non_null使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GNUNET_free_non_null函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: cleanup

/**
 * Assuming all peers have been destroyed cleanup run handle
 *
 * @param rc the run context
 */
static void
cleanup (struct GNUNET_TESTBED_RunHandle *rc)
{
  unsigned int hid;

  GNUNET_assert (NULL == rc->register_hosts_task);
  GNUNET_assert (NULL == rc->reg_handle);
  GNUNET_assert (NULL == rc->peers);
  GNUNET_assert (NULL == rc->hclist);
  GNUNET_assert (RC_PEERS_SHUTDOWN == rc->state);
  GNUNET_assert (0 == GNUNET_CONTAINER_multihashmap32_size (rc->rcop_map));
  GNUNET_CONTAINER_multihashmap32_destroy (rc->rcop_map);
  if (NULL != rc->c)
    GNUNET_TESTBED_controller_disconnect (rc->c);
  if (NULL != rc->cproc)
    GNUNET_TESTBED_controller_stop (rc->cproc);
  if (NULL != rc->h)
    GNUNET_TESTBED_host_destroy (rc->h);
  for (hid = 0; hid < rc->num_hosts; hid++)
    GNUNET_TESTBED_host_destroy (rc->hosts[hid]);
  GNUNET_free_non_null (rc->hosts);
  if (NULL != rc->cfg)
    GNUNET_CONFIGURATION_destroy (rc->cfg);
  GNUNET_free_non_null (rc->topo_file);
  GNUNET_free_non_null (rc->trusted_ip);
  GNUNET_free (rc);
}
开发者ID:muggenhor,项目名称:GNUnet,代码行数:32,代码来源:testbed_api_testbed.c


示例2: terminate_task

static void
terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  struct GNUNET_CORE_Handle *ch;

  err_task = GNUNET_SCHEDULER_NO_TASK;
  GNUNET_STATISTICS_destroy (p1.stats, GNUNET_NO);
  GNUNET_STATISTICS_destroy (p2.stats, GNUNET_NO);
  GNUNET_TRANSPORT_get_hello_cancel (p2.ghh);
  GNUNET_TRANSPORT_get_hello_cancel (p1.ghh);
  if (p1.nth != NULL)
  {
    GNUNET_CORE_notify_transmit_ready_cancel (p1.nth);
    p1.nth = NULL;
  }
  if (connect_task != GNUNET_SCHEDULER_NO_TASK)
  {
    GNUNET_SCHEDULER_cancel (connect_task);
    connect_task = GNUNET_SCHEDULER_NO_TASK;
  }
  ch = p1.ch;
  p1.ch = NULL;
  GNUNET_CORE_disconnect (ch);
  ch = p2.ch;
  p2.ch = NULL;
  GNUNET_CORE_disconnect (ch);
  GNUNET_TRANSPORT_disconnect (p1.th);
  p1.th = NULL;
  GNUNET_TRANSPORT_disconnect (p2.th);
  p2.th = NULL;
  GNUNET_free_non_null (p1.hello);
  GNUNET_free_non_null (p2.hello);
}
开发者ID:claudiuolteanu,项目名称:gnunet-1,代码行数:33,代码来源:test_core_quota_compliance.c


示例3: do_shutdown

void
do_shutdown (void *cls,
             const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  unsigned int ca;

  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");

  if (NULL != mlp)
  {
    GAS_mlp_done (mlp);
    mlp = NULL;
  }

  if (NULL != a)
  {
    for (ca=0; ca < (peers * addresses); ca++)
    {
      GNUNET_free (a[ca].plugin);
      GNUNET_free (a[ca].ats);
    }
  }

  if (NULL != amap)
    GNUNET_CONTAINER_multihashmap_destroy(amap);
  GNUNET_free_non_null (a);
  GNUNET_free_non_null (p);

}
开发者ID:schanzen,项目名称:gnunet-mirror,代码行数:29,代码来源:perf_ats_mlp.c


示例4: end

static void
end ()
{
  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n");
  if (die_task != GNUNET_SCHEDULER_NO_TASK)
  {
    GNUNET_SCHEDULER_cancel (die_task);
    die_task = GNUNET_SCHEDULER_NO_TASK;
  }
  if (NULL != atsh)
  GNUNET_ATS_scheduling_done (atsh);
  if (phal != NULL)
    GNUNET_ATS_performance_list_addresses_cancel (phal);
  phal = NULL;
  if (ph != NULL)
    GNUNET_ATS_performance_done (ph);
  ph = NULL;

  GNUNET_free_non_null (p0_addresses[0].addr);
  GNUNET_free_non_null (p0_addresses[1].addr);
  GNUNET_free_non_null (p1_addresses[0].addr);
  GNUNET_free_non_null (p1_addresses[1].addr);

  ret = 0;
}
开发者ID:schanzen,项目名称:gnunet-mirror,代码行数:25,代码来源:test_ats_api_performance.c


示例5: GNUNET_DNSPARSER_free_record

/**
 * Free the given DNS record.
 *
 * @param r record to free
 */
void
GNUNET_DNSPARSER_free_record (struct GNUNET_DNSPARSER_Record *r)
{
  GNUNET_free_non_null (r->name);
  switch (r->type)
  {
  case GNUNET_DNSPARSER_TYPE_MX:
    GNUNET_DNSPARSER_free_mx (r->data.mx);
    break;
  case GNUNET_DNSPARSER_TYPE_SOA:
    GNUNET_DNSPARSER_free_soa (r->data.soa);
    break;
  case GNUNET_DNSPARSER_TYPE_SRV:
    GNUNET_DNSPARSER_free_srv (r->data.srv);
    break;
  case GNUNET_DNSPARSER_TYPE_CERT:
    GNUNET_DNSPARSER_free_cert (r->data.cert);
    break;
  case GNUNET_DNSPARSER_TYPE_NS:
  case GNUNET_DNSPARSER_TYPE_CNAME:
  case GNUNET_DNSPARSER_TYPE_PTR:
    GNUNET_free_non_null (r->data.hostname);
    break;
  default:
    GNUNET_free_non_null (r->data.raw.data);
    break;
  }
}
开发者ID:GNUnet,项目名称:gnunet,代码行数:33,代码来源:dnsparser.c


示例6: test_service_configuration

/**
 * Try connecting to the server using UNIX domain sockets.
 *
 * @param service_name name of service to connect to
 * @param cfg configuration to use
 * @return GNUNET_OK if the configuration is valid, GNUNET_SYSERR if not
 */
static int
test_service_configuration (const char *service_name,
			    const struct GNUNET_CONFIGURATION_Handle *cfg)
{
  int ret = GNUNET_SYSERR;
  char *hostname = NULL;
  unsigned long long port;
#if AF_UNIX
  char *unixpath = NULL;

  if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && 
      (0 < strlen (unixpath)))     
    ret = GNUNET_OK;
  GNUNET_free_non_null (unixpath);
#endif

  if ( (GNUNET_YES ==
	GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT")) &&
       (GNUNET_OK ==
	GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT", &port)) && 
       (port <= 65535) && (0 != port) &&
       (GNUNET_OK ==
	GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "HOSTNAME",
					       &hostname)) &&
       (0 != strlen (hostname)) )
    ret = GNUNET_OK;
  GNUNET_free_non_null (hostname);
  return ret;
}
开发者ID:schanzen,项目名称:gnunet-mirror,代码行数:36,代码来源:client.c


示例7: oprelease_get_stats

/**
 * Function called when get_statistics operation is cancelled or marked as done
 *
 * @param cls the GetStatsContext
 */
static void
oprelease_get_stats (void *cls)
{
  struct GetStatsContext *sc = cls;
  unsigned int peer;

  LOG_DEBUG ("Cleaning up get_statistics operation\n");
  if (NULL != sc->call_completion_task_id)
    GNUNET_SCHEDULER_cancel (sc->call_completion_task_id);
  if (NULL != sc->ops)
  {
    for (peer = 0; peer < sc->num_peers; peer++)
    {
      if (NULL != sc->ops[peer])
      {
        GNUNET_TESTBED_operation_done (sc->ops[peer]);
        sc->ops[peer] = NULL;
      }
    }
    GNUNET_free (sc->ops);
  }
  GNUNET_free_non_null (sc->subsystem);
  GNUNET_free_non_null (sc->name);
  GNUNET_free (sc);
  if (GNUNET_YES ==
      GNUNET_TESTBED_operation_queue_destroy_empty_ (no_wait_queue))
    no_wait_queue = NULL;
}
开发者ID:GNUnet,项目名称:gnunet,代码行数:33,代码来源:testbed_api_statistics.c


示例8: add_host_to_known_hosts

/**
 * Add a host to the list and notify clients about this event
 *
 * @param identity the identity of the host
 * @return the HostEntry
 */
static struct HostEntry *
add_host_to_known_hosts (const struct GNUNET_PeerIdentity *identity)
{
  struct HostEntry *entry;
  struct ReadHostFileContext r;
  char *fn;

  entry = GNUNET_CONTAINER_multipeermap_get (hostmap, identity);
  if (NULL == entry)
  {
    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding new peer `%s'\n", GNUNET_i2s (identity));
    GNUNET_STATISTICS_update (stats, gettext_noop ("# peers known"), 1,
			      GNUNET_NO);
    entry = GNUNET_new (struct HostEntry);
    entry->identity = *identity;
    GNUNET_assert (GNUNET_OK ==
                   GNUNET_CONTAINER_multipeermap_put (hostmap, &entry->identity, entry,
                                                      GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
    notify_all (entry);
    fn = get_host_filename (identity);
    if (NULL != fn)
    {
      read_host_file (fn, GNUNET_YES, &r);
      if (NULL != r.hello)
      	update_hello (identity, r.hello);
      if (NULL != r.friend_only_hello)
      	update_hello (identity, r.friend_only_hello);
      GNUNET_free_non_null (r.hello);
      GNUNET_free_non_null (r.friend_only_hello);
      GNUNET_free (fn);
    }
  }
开发者ID:claudiuolteanu,项目名称:gnunet-1,代码行数:38,代码来源:gnunet-service-peerinfo.c


示例9: send_shorten_response

/**
 * Send shorten response back to client
 * 
 * @param cls the closure containing a client shorten handle
 * @param name the shortened name result or NULL if cannot be shortened
 */
static void
send_shorten_response(void* cls, const char* name)
{
  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message with %s\n",
              "SHORTEN_RESULT", name);
  struct GNUNET_GNS_ClientShortenResultMessage *rmsg;
  struct ClientShortenHandle *csh = (struct ClientShortenHandle *)cls;
  
  if (name == NULL)
  {
    name = "";
  }

  rmsg = GNUNET_malloc(sizeof(struct GNUNET_GNS_ClientShortenResultMessage)
                       + strlen(name) + 1);
  
  rmsg->id = csh->unique_id;
  rmsg->header.type = htons(GNUNET_MESSAGE_TYPE_GNS_SHORTEN_RESULT);
  rmsg->header.size = 
    htons(sizeof(struct GNUNET_GNS_ClientShortenResultMessage) +
          strlen(name) + 1);

  strcpy((char*)&rmsg[1], name);

  GNUNET_SERVER_notification_context_unicast (nc, csh->client,
                              (const struct GNUNET_MessageHeader *) rmsg,
                              GNUNET_NO);
  GNUNET_SERVER_receive_done (csh->client, GNUNET_OK);
  
  GNUNET_free(rmsg);
  GNUNET_free_non_null(csh->name);
  GNUNET_free_non_null(csh->zone_key);
  GNUNET_free(csh);

}
开发者ID:h4ck3rm1k3,项目名称:gnunet-debian,代码行数:41,代码来源:gnunet-service-gns.c


示例10: shutdown_task

static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  struct SysmonProperty *sp;
  struct SysmonProperty *next;

  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sysdaemon stopping ... \n");

  end_task = GNUNET_SCHEDULER_NO_TASK;

  if (NULL != stats)
  {
    GNUNET_STATISTICS_destroy (stats, GNUNET_YES);
    stats = NULL;
  }

  next = sp_head;
  while (NULL != (sp = next))
  {
      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping `%s' \n", sp->desc);
      GNUNET_CONTAINER_DLL_remove (sp_head, sp_tail, sp);
      next = sp->next;
      if (GNUNET_SCHEDULER_NO_TASK != sp->task_id)
      {
        GNUNET_SCHEDULER_cancel (sp->task_id);
        sp->task_id = GNUNET_SCHEDULER_NO_TASK;
      }
      GNUNET_free_non_null (sp->cmd);
      GNUNET_free_non_null (sp->cmd_args);
      GNUNET_free (sp->desc);
      GNUNET_free (sp);
  }

}
开发者ID:schanzen,项目名称:gnunet-mirror,代码行数:34,代码来源:gnunet-daemon-sysmon.c


示例11: main

/**
 * The main function.
 *
 * @param argc number of arguments from the command line
 * @param argv command line arguments
 * @return 0 ok, 1 on error
 */
int
main (int argc, char *const *argv)
{
  int res;
  resolve_addresses_numeric = GNUNET_NO;
  op_monitor = GNUNET_NO;
  op_list_all = GNUNET_NO;
  op_list_used = GNUNET_NO;
  op_set_pref = GNUNET_NO;
  pending = 0;
  receive_done = GNUNET_NO;

  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
      {'u', "used", NULL,
       gettext_noop ("get list of active addresses currently used"),
       0, &GNUNET_GETOPT_set_one, &op_list_used},
       {'a', "all", NULL,
        gettext_noop ("get list of all active addresses"),
        0, &GNUNET_GETOPT_set_one, &op_list_all},
      {'n', "numeric", NULL,
       gettext_noop ("do not resolve IP addresses to hostnames"),
       0, &GNUNET_GETOPT_set_one, &resolve_addresses_numeric},
       {'m', "monitor", NULL,
        gettext_noop ("monitor mode"),
        0, &GNUNET_GETOPT_set_one, &op_monitor},
       {'p', "preference", NULL,
         gettext_noop ("set preference for the given peer"),
         0, &GNUNET_GETOPT_set_one, &op_set_pref},
       {'i', "id", "TYPE",
         gettext_noop ("peer id"),
         1, &GNUNET_GETOPT_set_string, &pid_str},
       {'t', "type", "TYPE",
         gettext_noop ("preference type to set: latency | bandwidth"),
         1, &GNUNET_GETOPT_set_string, &type_str},
       {'k', "value", "VALUE",
         gettext_noop ("preference value"),
         1, &GNUNET_GETOPT_set_uint, &value},
       {'V', "verbose", NULL,
        gettext_noop ("verbose output (include ATS address properties)"),
        0, &GNUNET_GETOPT_set_one, &verbose},
    GNUNET_GETOPT_OPTION_END
  };

  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
    return 2;

  res = GNUNET_PROGRAM_run (argc, argv, "gnunet-ats",
                              gettext_noop ("Print information about ATS state"), options, &run,
                              NULL);
  GNUNET_free_non_null (pid_str);
  GNUNET_free_non_null (type_str);
  GNUNET_free ((void *) argv);

  if (GNUNET_OK == res)
    return ret;
  else
    return 1;

}
开发者ID:schanzen,项目名称:gnunet-mirror,代码行数:66,代码来源:gnunet-ats.c


示例12: GNUNET_FS_file_information_destroy

/**
 * Destroy publish-structure.  Clients should never destroy publish
 * structures that were passed to #GNUNET_FS_publish_start already.
 *
 * @param fi structure to destroy
 * @param cleaner function to call on each entry in the structure
 *        (useful to clean up client_info); can be NULL; return
 *        values are ignored
 * @param cleaner_cls closure for @a cleaner
 */
void
GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi,
                                    GNUNET_FS_FileInformationProcessor cleaner,
                                    void *cleaner_cls)
{
  struct GNUNET_FS_FileInformation *pos;
  int no;

  no = GNUNET_NO;
  if (GNUNET_YES == fi->is_directory)
  {
    /* clean up directory */
    while (NULL != (pos = fi->data.dir.entries))
    {
      fi->data.dir.entries = pos->next;
      GNUNET_FS_file_information_destroy (pos, cleaner, cleaner_cls);
    }
    /* clean up client-info */
    if (NULL != cleaner)
      cleaner (cleaner_cls, fi, fi->data.dir.dir_size, fi->meta, &fi->keywords,
               &fi->bo, &no, &fi->client_info);
    GNUNET_free_non_null (fi->data.dir.dir_data);
  }
  else
  {
    /* call clean-up function of the reader */
    if (NULL != fi->data.file.reader)
    {
      (void) fi->data.file.reader (fi->data.file.reader_cls, 0, 0, NULL, NULL);
      fi->data.file.reader = NULL;
    }
    /* clean up client-info */
    if (NULL != cleaner)
      cleaner (cleaner_cls, fi, fi->data.file.file_size, fi->meta,
               &fi->keywords, &fi->bo, &fi->data.file.do_index,
               &fi->client_info);
  }
  GNUNET_free_non_null (fi->filename);
  GNUNET_free_non_null (fi->emsg);
  if (NULL != fi->sks_uri)
      GNUNET_FS_uri_destroy (fi->sks_uri);
  if (NULL != fi->chk_uri)
      GNUNET_FS_uri_destroy (fi->chk_uri);
  /* clean up serialization */
  if ((NULL != fi->serialization) && (0 != UNLINK (fi->serialization)))
    GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink",
                              fi->serialization);
  if (NULL != fi->keywords)
    GNUNET_FS_uri_destroy (fi->keywords);
  if (NULL != fi->meta)
    GNUNET_CONTAINER_meta_data_destroy (fi->meta);
  GNUNET_free_non_null (fi->serialization);
  if (NULL != fi->te)
  {
    GNUNET_FS_tree_encoder_finish (fi->te, NULL);
    fi->te = NULL;
  }
  GNUNET_free (fi);
}
开发者ID:krattai,项目名称:AEBL,代码行数:69,代码来源:fs_file_information.c


示例13: meta_item_free

/**
 * Free meta data item.
 *
 * @param item item to free
 */
static void
meta_item_free (struct MetaItem *item)
{
  GNUNET_free_non_null (item->plugin_name);
  GNUNET_free_non_null (item->mime_type);
  GNUNET_free_non_null (item->data);
  GNUNET_free (item);
}
开发者ID:h4ck3rm1k3,项目名称:gnunet-debian,代码行数:13,代码来源:container_meta_data.c


示例14: GNUNET_FS_unindex_signal_suspend_

/**
 * Create SUSPEND event for the given unindex operation
 * and then clean up our state (without stop signal).
 *
 * @param cls the `struct GNUNET_FS_UnindexContext` to signal for
 */
void
GNUNET_FS_unindex_signal_suspend_ (void *cls)
{
  struct GNUNET_FS_UnindexContext *uc = cls;
  struct GNUNET_FS_ProgressInfo pi;

  /* FIXME: lots of duplication with unindex_stop here! */
  if (uc->dscan != NULL)
  {
    GNUNET_FS_directory_scan_abort (uc->dscan);
    uc->dscan = NULL;
  }
  if (NULL != uc->dqe)
  {
    GNUNET_DATASTORE_cancel (uc->dqe);
    uc->dqe = NULL;
  }
  if (uc->fhc != NULL)
  {
    GNUNET_CRYPTO_hash_file_cancel (uc->fhc);
    uc->fhc = NULL;
  }
  if (NULL != uc->ksk_uri)
  {
    GNUNET_FS_uri_destroy (uc->ksk_uri);
    uc->ksk_uri = NULL;
  }
  if (uc->client != NULL)
  {
    GNUNET_CLIENT_disconnect (uc->client);
    uc->client = NULL;
  }
  if (NULL != uc->dsh)
  {
    GNUNET_DATASTORE_disconnect (uc->dsh, GNUNET_NO);
    uc->dsh = NULL;
  }
  if (NULL != uc->tc)
  {
    GNUNET_FS_tree_encoder_finish (uc->tc, NULL);
    uc->tc = NULL;
  }
  if (uc->fh != NULL)
  {
    GNUNET_DISK_file_close (uc->fh);
    uc->fh = NULL;
  }
  GNUNET_FS_end_top (uc->h, uc->top);
  pi.status = GNUNET_FS_STATUS_UNINDEX_SUSPEND;
  GNUNET_FS_unindex_make_status_ (&pi, uc,
                                  (uc->state ==
                                   UNINDEX_STATE_COMPLETE) ? uc->file_size : 0);
  GNUNET_break (NULL == uc->client_info);
  GNUNET_free (uc->filename);
  GNUNET_free_non_null (uc->serialization);
  GNUNET_free_non_null (uc->emsg);
  GNUNET_free (uc);
}
开发者ID:tg-x,项目名称:gnunet,代码行数:64,代码来源:fs_unindex.c


示例15: GNUNET_CONNECTION_destroy

/**
 * Close the connection and free associated resources.  There must
 * not be any pending requests for reading or writing to the
 * connection at this time.
 *
 * @param connection connection to destroy
 */
void
GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *connection)
{
  struct AddressProbe *pos;

  LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down connection (%p)\n", connection);
  GNUNET_assert (NULL == connection->nth.notify_ready);
  GNUNET_assert (NULL == connection->receiver);
  if (GNUNET_SCHEDULER_NO_TASK != connection->write_task)
  {
    GNUNET_SCHEDULER_cancel (connection->write_task);
    connection->write_task = GNUNET_SCHEDULER_NO_TASK;
    connection->write_buffer_off = 0;
  }
  if (GNUNET_SCHEDULER_NO_TASK != connection->read_task)
  {
    GNUNET_SCHEDULER_cancel (connection->read_task);
    connection->read_task = GNUNET_SCHEDULER_NO_TASK;
  }
  if (GNUNET_SCHEDULER_NO_TASK != connection->nth.timeout_task)
  {
    GNUNET_SCHEDULER_cancel (connection->nth.timeout_task);
    connection->nth.timeout_task = GNUNET_SCHEDULER_NO_TASK;
  }
  connection->nth.notify_ready = NULL;
  if (NULL != connection->dns_active)
  {
    GNUNET_RESOLVER_request_cancel (connection->dns_active);
    connection->dns_active = NULL;
  }
  while (NULL != (pos = connection->ap_head))
  {
    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (pos->sock));
    GNUNET_SCHEDULER_cancel (pos->task);
    GNUNET_CONTAINER_DLL_remove (connection->ap_head, connection->ap_tail, pos);
    GNUNET_free (pos);
  }
  if ( (NULL != connection->sock) &&
       (GNUNET_YES != connection->persist) )
  {
    if ((GNUNET_YES != GNUNET_NETWORK_socket_shutdown (connection->sock, SHUT_RDWR)) && 
	(ENOTCONN != errno) && 
	(ECONNRESET != errno) )
      LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "shutdown");    
  }
  if (NULL != connection->sock)
  {
    if (GNUNET_YES != connection->persist)
      GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (connection->sock));
    else
      GNUNET_free (connection->sock); /* at least no memory leak (we deliberately
				       * leak the socket in this special case) ... */
  }
  GNUNET_free_non_null (connection->addr);
  GNUNET_free_non_null (connection->hostname);
  GNUNET_free (connection->write_buffer);
  GNUNET_free (connection);
}
开发者ID:h4ck3rm1k3,项目名称:gnunet-debian,代码行数:65,代码来源:connection.c


示例16: GNUNET_DNSPARSER_free_soa

/**
 * Free SOA information record.
 *
 * @param soa record to free
 */
void
GNUNET_DNSPARSER_free_soa (struct GNUNET_DNSPARSER_SoaRecord *soa)
{
  if (NULL == soa)
    return;
  GNUNET_free_non_null (soa->mname);
  GNUNET_free_non_null (soa->rname);
  GNUNET_free (soa);
}
开发者ID:GNUnet,项目名称:gnunet,代码行数:14,代码来源:dnsparser.c


示例17: read_info

/**
 * read the pseudonym infomation from a file
 * @param cfg configuration to use
 * @param nsid hash code of a pseudonym
 * @param meta meta data to be read from a file
 * @param ranking ranking of a pseudonym
 * @param ns_name name of a pseudonym
 */
static int
read_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
           const struct GNUNET_HashCode * nsid,
           struct GNUNET_CONTAINER_MetaData **meta, int32_t * ranking,
           char **ns_name)
{
  char *fn;
  char *emsg;
  struct GNUNET_BIO_ReadHandle *fileR;

  fn = get_data_filename (cfg, PS_METADATA_DIR, nsid);
  GNUNET_assert (fn != NULL);
  if (GNUNET_YES !=
      GNUNET_DISK_file_test (fn))
  {
    GNUNET_free (fn);
    return GNUNET_SYSERR;
  }
  fileR = GNUNET_BIO_read_open (fn);
  if (fileR == NULL)
  {
    GNUNET_free (fn);
    return GNUNET_SYSERR;
  }
  emsg = NULL;
  *ns_name = NULL;
  if ((GNUNET_OK != GNUNET_BIO_read_int32 (fileR, ranking)) ||
      (GNUNET_OK !=
       GNUNET_BIO_read_string (fileR, "Read string error!", ns_name, 200)) ||
      (GNUNET_OK !=
       GNUNET_BIO_read_meta_data (fileR, "Read meta data error!", meta)))
  {
    (void) GNUNET_BIO_read_close (fileR, &emsg);
    GNUNET_free_non_null (emsg);
    GNUNET_free_non_null (*ns_name);
    *ns_name = NULL;
    GNUNET_break (GNUNET_OK == GNUNET_DISK_directory_remove (fn));
    GNUNET_free (fn);
    return GNUNET_SYSERR;
  }
  if (GNUNET_OK != GNUNET_BIO_read_close (fileR, &emsg))
  {
    LOG (GNUNET_ERROR_TYPE_WARNING,
         _("Failed to parse metadata about pseudonym from file `%s': %s\n"), fn,
         emsg);
    GNUNET_break (GNUNET_OK == GNUNET_DISK_directory_remove (fn));
    GNUNET_CONTAINER_meta_data_destroy (*meta);
    *meta = NULL;
    GNUNET_free_non_null (*ns_name);
    *ns_name = NULL;
    GNUNET_free_non_null (emsg);
    GNUNET_free (fn);
    return GNUNET_SYSERR;
  }
  GNUNET_free (fn);
  return GNUNET_OK;
}
开发者ID:amatus,项目名称:gnunet-debian,代码行数:65,代码来源:pseudonym.c


示例18: shutdown_task

/**
 * Task to clean up and shutdown nicely
 *
 * @param cls NULL
 * @param tc the TaskContext from scheduler
 */
static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  struct MessageQueue *mq_entry;
  uint32_t id;

  shutdown_task_id = NULL;
  LOG_DEBUG ("Shutting down testbed service\n");
  /* cleanup any remaining forwarded operations */
  GST_clear_fopcq ();
  GST_free_lcfq ();
  GST_free_mctxq ();
  GST_free_occq ();
  GST_free_roccq ();
  GST_free_nccq ();
  GST_neighbour_list_clean();
  GST_free_prcq ();
  /* Clear peer list */
  GST_destroy_peers ();
  /* Clear route list */
  GST_route_list_clear ();
  /* Clear GST_slave_list */
  GST_slave_list_clear ();
  /* Clear host list */
  for (id = 0; id < GST_host_list_size; id++)
    if (NULL != GST_host_list[id])
      GNUNET_TESTBED_host_destroy (GST_host_list[id]);
  GNUNET_free_non_null (GST_host_list);
  if (NULL != GST_context)
  {
    GNUNET_free_non_null (GST_context->master_ip);
    if (NULL != GST_context->system)
      GNUNET_TESTING_system_destroy (GST_context->system, GNUNET_YES);
    GNUNET_SERVER_client_drop (GST_context->client);
    GNUNET_free (GST_context);
    GST_context = NULL;
  }
  if (NULL != transmit_handle)
    GNUNET_SERVER_notify_transmit_ready_cancel (transmit_handle);
  while (NULL != (mq_entry = mq_head))
  {
    GNUNET_free (mq_entry->msg);
    GNUNET_SERVER_client_drop (mq_entry->client);
    GNUNET_CONTAINER_DLL_remove (mq_head, mq_tail, mq_entry);
    GNUNET_free (mq_entry);
  }
  GNUNET_free_non_null (hostname);
  /* Free hello cache */
  GST_cache_clear ();
  GST_connection_pool_destroy ();
  GNUNET_TESTBED_operation_queue_destroy_ (GST_opq_openfds);
  GST_opq_openfds = NULL;
  GST_stats_destroy ();
  GST_barriers_destroy ();
  GNUNET_CONFIGURATION_destroy (GST_config);
}
开发者ID:muggenhor,项目名称:GNUnet,代码行数:62,代码来源:gnunet-service-testbed.c


示例19: clean

static void
clean (struct SplittedHTTPAddress *addr)
{
  if (NULL == addr)
    return;
  GNUNET_free_non_null (addr->host);
  GNUNET_free_non_null (addr->path);
  GNUNET_free_non_null (addr->protocol);
  GNUNET_free (addr);
}
开发者ID:muggenhor,项目名称:GNUnet,代码行数:10,代码来源:test_http_common.c


示例20: clean

void
clean (struct SplittedHTTPAddress *addr)
{
	if (NULL != addr)
	{
		GNUNET_free_non_null (addr->host);
		GNUNET_free_non_null (addr->path);
		GNUNET_free_non_null (addr->protocol);
		GNUNET_free_non_null (addr);
	}
}
开发者ID:amatus,项目名称:gnunet-debian,代码行数:11,代码来源:test_http_common.c



注:本文中的GNUNET_free_non_null函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GNUNET_h2s函数代码示例发布时间:2022-05-30
下一篇:
C++ GNUNET_free函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap