这篇教程C++ GNUNET_SCHEDULER_shutdown函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GNUNET_SCHEDULER_shutdown函数的典型用法代码示例。如果您正苦于以下问题:C++ GNUNET_SCHEDULER_shutdown函数的具体用法?C++ GNUNET_SCHEDULER_shutdown怎么用?C++ GNUNET_SCHEDULER_shutdown使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GNUNET_SCHEDULER_shutdown函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: create_channel/** * Call MESH's monitor API, get info of one connection. * * @param cls Closure (unused). * @param tc TaskContext */static voidcreate_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc){ struct GNUNET_PeerIdentity pid; enum GNUNET_MESH_ChannelOption opt; GNUNET_assert (NULL == ch); if (GNUNET_OK != GNUNET_CRYPTO_eddsa_public_key_from_string (target_id, strlen (target_id), &pid.public_key)) { FPRINTF (stderr, _("Invalid target `%s'/n"), target_id); GNUNET_SCHEDULER_shutdown (); return; } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to `%s'/n", target_id); opt = GNUNET_MESH_OPTION_DEFAULT | GNUNET_MESH_OPTION_RELIABLE; ch = GNUNET_MESH_channel_create (mh, NULL, &pid, target_port, opt); if (GNUNET_NO == echo) listen_stdio (); else GNUNET_SCHEDULER_add_now (send_echo, NULL);}
开发者ID:claudiuolteanu,项目名称:gnunet-1,代码行数:33,
示例2: data_ready/** * Function called to notify a client about the connection * begin ready to queue more data. "buf" will be * NULL and "size" zero if the connection was closed for * writing in the meantime. * * FIXME * * @param cls closure * @param size number of bytes available in buf * @param buf where the callee should write the message * @return number of bytes written to buf */size_tdata_ready (void *cls, size_t size, void *buf){ struct GNUNET_MessageHeader *msg; size_t total_size; if (NULL == buf || 0 == size) { GNUNET_SCHEDULER_shutdown(); return 0; } total_size = data_size + sizeof (struct GNUNET_MessageHeader); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sending %u bytes/n", data_size); GNUNET_assert (size >= total_size); msg = buf; msg->size = htons (total_size); msg->type = htons (GNUNET_MESSAGE_TYPE_MESH_CLI); memcpy (&msg[1], cls, data_size); if (GNUNET_NO == echo) { listen_stdio (); } else { echo_time = GNUNET_TIME_absolute_get (); } return total_size;}
开发者ID:claudiuolteanu,项目名称:gnunet-1,代码行数:44,
示例3: tunnel_callback/** * Method called to retrieve information about a specific tunnel the mesh peer * has established, o`r is trying to establish. * * @param cls Closure. * @param peer Peer towards whom the tunnel is directed. * @param n_channels Number of channels. * @param n_connections Number of connections. * @param channels Channels. * @param connections Connections. * @param estate Encryption status. * @param cstate Connectivity status. */voidtunnel_callback (void *cls, const struct GNUNET_PeerIdentity *peer, unsigned int n_channels, unsigned int n_connections, uint32_t *channels, struct GNUNET_HashCode *connections, unsigned int estate, unsigned int cstate){ unsigned int i; if (NULL != peer) { FPRINTF (stdout, "Tunnel %s/n", GNUNET_i2s_full (peer)); FPRINTF (stdout, "- %u channels/n", n_channels); for (i = 0; i < n_channels; i++) FPRINTF (stdout, " %u/n", channels[i]); FPRINTF (stdout, "- %u connections/n", n_connections); for (i = 0; i < n_connections; i++) FPRINTF (stdout, " %s/n", GNUNET_h2s_full (&connections[i])); FPRINTF (stdout, "- enc state: %u/n", estate); FPRINTF (stdout, "- con state: %u/n", cstate); } if (GNUNET_YES != monitor_connections) { GNUNET_SCHEDULER_shutdown(); } return;}
开发者ID:claudiuolteanu,项目名称:gnunet-1,代码行数:44,
示例4: topology_completedstatic voidtopology_completed (void *cls, unsigned int nsuccess, unsigned int nfailures){ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Links successful %u / %u failed/n", nsuccess, nfailures); GNUNET_TESTBED_operation_done (topology_op); topology_op = NULL; if (nfailures > 0) { fprintf (stderr, "Error: links successful %u but %u failed/n", nsuccess, nfailures); ok = 1; } else ok = 0; GNUNET_SCHEDULER_shutdown ();}
开发者ID:muggenhor,项目名称:GNUnet,代码行数:25,
示例5: do_shutdown/** * Shutdown nicely * * @param cls NULL * @param tc the task context */static voiddo_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc){ struct DLLOperation *dll_op; unsigned int nhost; shutdown_task = GNUNET_SCHEDULER_NO_TASK; if (GNUNET_SCHEDULER_NO_TASK != abort_task) GNUNET_SCHEDULER_cancel (abort_task); if (GNUNET_SCHEDULER_NO_TASK != register_hosts_task) GNUNET_SCHEDULER_cancel (register_hosts_task); if (NULL != reg_handle) GNUNET_TESTBED_cancel_registration (reg_handle); if (NULL != topology_op) GNUNET_TESTBED_operation_done (topology_op); for (nhost = 0; nhost < num_hosts; nhost++) if (NULL != hosts[nhost]) GNUNET_TESTBED_host_destroy (hosts[nhost]); GNUNET_free_non_null (hosts); while (NULL != (dll_op = dll_op_head)) { GNUNET_TESTBED_operation_done (dll_op->op); GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op); GNUNET_free (dll_op); } if (NULL != mc) GNUNET_TESTBED_controller_disconnect (mc); if (NULL != mc_proc) GNUNET_TESTBED_controller_stop (mc_proc); if (NULL != cfg) GNUNET_CONFIGURATION_destroy (cfg); GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */}
开发者ID:schanzen,项目名称:gnunet-mirror,代码行数:39,
示例6: allocation_cb/** * Callback invoked from the VPN service once a redirection is * available. Provides the IP address that can now be used to * reach the requested destination. * * @param cls closure * @param af address family, AF_INET or AF_INET6; AF_UNSPEC on error; * will match 'result_af' from the request * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') * that the VPN allocated for the redirection; * traffic to this IP will now be redirected to the * specified target peer; NULL on error */static voidallocation_cb (void *cls, int af, const void *address){ char buf[INET6_ADDRSTRLEN]; request = NULL; switch (af) { case AF_INET6: case AF_INET: FPRINTF (stdout, "%s/n", inet_ntop (af, address, buf, sizeof (buf))); break; case AF_UNSPEC: GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Error creating tunnel/n")); ret = 1; break; default: break; } GNUNET_SCHEDULER_shutdown ();}
开发者ID:tg-x,项目名称:gnunet,代码行数:39,
示例7: peer_create_cb/** * Functions of this signature are called when a peer has been successfully * created * * @param cls the closure from GNUNET_TESTBED_peer_create() * @param peer the handle for the created peer; NULL on any error during * creation * @param emsg NULL if peer is not NULL; else MAY contain the error description */static voidpeer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg){ struct RunContextOperation *rcop = cls; struct GNUNET_TESTBED_RunHandle *rc; GNUNET_assert (NULL != rcop); GNUNET_assert (NULL != (rc = rcop->rc)); remove_rcop (rc, rcop); GNUNET_TESTBED_operation_done (rcop->op); GNUNET_free (rcop); if (NULL == peer) { if (NULL != emsg) LOG (GNUNET_ERROR_TYPE_ERROR, "Error while creating a peer: %s/n", emsg); GNUNET_SCHEDULER_shutdown (); return; } rc->peers[rc->peer_count] = peer; rc->peer_count++; if (rc->peer_count < rc->num_peers) return; DEBUG ("%u peers created in %s/n", rc->num_peers, prof_time (rc)); rc->state = RC_PEERS_CREATED; GNUNET_SCHEDULER_add_now (&start_peers_task, rc);}
开发者ID:muggenhor,项目名称:GNUnet,代码行数:36,
示例8: do_downloadstatic voiddo_download (void *cls, const char *emsg){ struct DownloadContext *dc = cls; struct GNUNET_FS_Uri *uri = dc->uri; GNUNET_TESTBED_operation_done (op); op = NULL; if (NULL != dc->fn) { GNUNET_DISK_directory_remove (dc->fn); GNUNET_free (dc->fn); } GNUNET_free (dc); if (NULL != emsg) { GNUNET_SCHEDULER_shutdown (); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to stop source daemon: %s/n", emsg); GNUNET_FS_uri_destroy (uri); ok = 1; return; } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Downloading %llu bytes/n", (unsigned long long) FILESIZE); start_time = GNUNET_TIME_absolute_get (); GNUNET_FS_TEST_download (daemons[0], TIMEOUT, 1, SEED, uri, VERBOSE, &do_stop, NULL); GNUNET_FS_uri_destroy (uri);}
开发者ID:claudiuolteanu,项目名称:gnunet-1,代码行数:31,
示例9: cleanup_task/** * Task run during shutdown. * * @param cls unused * @param tc unused */static voidcleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc){ struct ClientPeerContext *cp; cp = cp_head; while (NULL != cp) { GNUNET_CONTAINER_DLL_remove (cp_head, cp_tail, cp); destroy_clientpeer (cp); cp = cp_head; } if (NULL != cadet) { GNUNET_CADET_disconnect (cadet); cadet = NULL; } if (NULL != peerstore) { GNUNET_PEERSTORE_disconnect (peerstore, GNUNET_YES); peerstore = NULL; } GNUNET_SENSOR_destroy_sensors (sensors); if (NULL != sensor_dir) { GNUNET_free (sensor_dir); sensor_dir = NULL; } GNUNET_SCHEDULER_shutdown ();}
开发者ID:muggenhor,项目名称:GNUnet,代码行数:36,
示例10: handle_shutdown/** * Handler for SHUTDOWN message. * * @param cls closure (refers to service) * @param client identification of the client * @param message the actual message */static voidhandle_shutdown (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message){ GNUNET_SCHEDULER_shutdown (); GNUNET_SERVER_client_persist_ (client);}
开发者ID:h4ck3rm1k3,项目名称:gnunet-debian,代码行数:14,
示例11: clean_upstatic voidclean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc){ if (p1.th != NULL) { if (p1.ghh != NULL) { GNUNET_TRANSPORT_get_hello_cancel (p1.ghh); p1.ghh = NULL; } GNUNET_TRANSPORT_disconnect (p1.th); p1.th = NULL; } if (p2.th != NULL) { if (p2.ghh != NULL) { GNUNET_TRANSPORT_get_hello_cancel (p2.ghh); p2.ghh = NULL; } GNUNET_TRANSPORT_disconnect (p2.th); p2.th = NULL; } GNUNET_SCHEDULER_shutdown ();}
开发者ID:claudiuolteanu,项目名称:gnunet-1,代码行数:25,
示例12: mesh_connect_cb/** * Callback to be called when a service connect operation is completed. * * @param cls The callback closure from functions generating an operation. * @param op The operation that has been finished. * @param ca_result The service handle returned from * GNUNET_TESTBED_ConnectAdapter() (mesh handle). * @param emsg Error message in case the operation has failed. * NULL if operation has executed successfully. */static void mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg){ struct GNUNET_MESH_TEST_Context *ctx = cls; unsigned int i; if (NULL != emsg) { fprintf (stderr, "Failed to connect to MESH service: %s/n", emsg); GNUNET_SCHEDULER_shutdown (); return; } for (i = 0; i < ctx->num_peers; i++) if (op == ctx->ops[i]) ctx->meshes[i] = ca_result; for (i = 0; i < ctx->num_peers; i++) if (NULL == ctx->meshes[i]) return; /* still some MESH connections missing */ /* all MESH connections ready! */ ctx->app_main (ctx->app_main_cls, ctx, ctx->num_peers, ctx->peers, ctx->meshes);}
开发者ID:amatus,项目名称:gnunet-debian,代码行数:39,
示例13: identity_cb/** * Callback invoked from identity service with ego information. * An @a ego of NULL means the ego was not found. * * @param cls closure with the configuration * @param ego an ego known to identity service, or NULL */static voididentity_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego){ const struct GNUNET_CONFIGURATION_Handle *cfg = cls; el = NULL; if (NULL == ego) { if (NULL != ego_name) { fprintf (stderr, _("Ego `%s' not known to identity service/n"), ego_name); } GNUNET_SCHEDULER_shutdown (); ret = -1; return; } zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego); GNUNET_free_non_null (ego_name); ego_name = NULL; GNUNET_CLIENT_service_test ("namestore", cfg, GNUNET_TIME_UNIT_SECONDS, &testservice_task, (void *) cfg);}
开发者ID:muggenhor,项目名称:GNUnet,代码行数:34,
示例14: testservice_id_taskstatic voidtestservice_id_task (void *cls, int result){ const struct GNUNET_CONFIGURATION_Handle *cfg = cls; if (result != GNUNET_YES) { fprintf (stderr, _("Identity service is not running/n")); GNUNET_SCHEDULER_shutdown (); ret = -1; return; } GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_shutdown, (void *) cfg); if (NULL == ego_name) { idh = GNUNET_IDENTITY_connect (cfg, &id_connect_cb, (void *) cfg); if (NULL == idh) fprintf (stderr, _("Cannot connect to identity service/n")); ret = -1; return; } el = GNUNET_IDENTITY_ego_lookup (cfg, ego_name, &identity_cb, (void *) cfg);}
开发者ID:muggenhor,项目名称:GNUnet,代码行数:28,
示例15: GCD_init/** * Initialize the DHT subsystem. * * @param c Configuration. */voidGCD_init (const struct GNUNET_CONFIGURATION_Handle *c){ LOG (GNUNET_ERROR_TYPE_DEBUG, "init/n"); if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (c, "CADET", "DHT_REPLICATION_LEVEL", &dht_replication_level)) { GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, "CADET", "DHT_REPLICATION_LEVEL", "USING DEFAULT"); dht_replication_level = 3; } if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (c, "CADET", "ID_ANNOUNCE_TIME", &id_announce_time)) { GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "CADET", "ID_ANNOUNCE_TIME", "MISSING"); GNUNET_SCHEDULER_shutdown (); return; } dht_handle = GNUNET_DHT_connect (c, 64); if (NULL == dht_handle) { GNUNET_break (0); } announce_delay = GNUNET_TIME_UNIT_SECONDS; announce_id_task = GNUNET_SCHEDULER_add_now (&announce_id, NULL); get_requests = GNUNET_CONTAINER_multihashmap32_create (32);}
开发者ID:GNUnet,项目名称:gnunet,代码行数:39,
示例16: decrypt_cb/** * Called when a decryption has succeeded. * * @param cls Plaintext * @param plaintext Plaintext */static void decrypt_cb (void *cls, const struct GNUNET_SECRETSHARING_Plaintext *plaintext){ struct GNUNET_SECRETSHARING_DecryptionHandle **dhp = cls; unsigned int n = dhp - decrypt_handles; num_decrypted++; *dhp = NULL; if (NULL == plaintext) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "decrypt failed for peer %u/n", n); return; } else if (0 == memcmp (&reference_plaintext, plaintext, sizeof (struct GNUNET_SECRETSHARING_Plaintext))) GNUNET_log (GNUNET_ERROR_TYPE_INFO, "decrypt got correct result for peer %u/n", n); else GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "decrypt got wrong result for peer %u/n", n); if (num_decrypted == num_peers) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "every peer decrypted/n"); GNUNET_SCHEDULER_shutdown (); } *dhp = NULL;}
开发者ID:claudiuolteanu,项目名称:gnunet-1,代码行数:33,
示例17: call_event_handlerstatic voidcall_event_handler (void *cls, enum GNUNET_CONVERSATION_CallEventCode code){ static enum GNUNET_CONVERSATION_CallEventCode expect = GNUNET_CONVERSATION_EC_CALL_RINGING; GNUNET_break (code == expect); switch (code) { case GNUNET_CONVERSATION_EC_CALL_RINGING: expect = GNUNET_CONVERSATION_EC_CALL_HUNG_UP; break; case GNUNET_CONVERSATION_EC_CALL_HUNG_UP: call = NULL; ok = 0; GNUNET_SCHEDULER_shutdown (); expect = -1; break; case GNUNET_CONVERSATION_EC_CALL_PICKED_UP: case GNUNET_CONVERSATION_EC_CALL_GNS_FAIL: case GNUNET_CONVERSATION_EC_CALL_SUSPENDED: case GNUNET_CONVERSATION_EC_CALL_RESUMED: fprintf (stderr, "Unexpected call code: %d/n", code); break; case GNUNET_CONVERSATION_EC_CALL_ERROR: fprintf (stderr, "Unexpected call code: %d/n", code); call = NULL; break; }}
开发者ID:GNUnet,项目名称:gnunet,代码行数:31,
示例18: do_shutdown/** * Shutdown nicely * * @param cls NULL */static voiddo_shutdown (void *cls){ if (NULL != abort_task) GNUNET_SCHEDULER_cancel (abort_task); GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */}
开发者ID:GNUnet,项目名称:gnunet,代码行数:12,
示例19: run/** * Main function run with scheduler. */static voidrun (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg){ //Lets create the socket lsock4 = bind_v4 (); if (NULL == lsock4) { GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind"); GNUNET_SCHEDULER_shutdown (); return; } GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Service listens on port %u/n", (unsigned int) port); rh = GNUNET_NAT_stun_make_request (stun_server, stun_port, lsock4, &request_callback, NULL); GNUNET_SCHEDULER_add_delayed (TIMEOUT, &stop, NULL);}
开发者ID:GNUnet,项目名称:gnunet,代码行数:28,
示例20: do_stopstatic voiddo_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc){ struct GNUNET_TIME_Relative del; char *fancy; GNUNET_SCHEDULER_shutdown (); if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) { del = GNUNET_TIME_absolute_get_duration (start_time); if (del.rel_value_us == 0) del.rel_value_us = 1; fancy = GNUNET_STRINGS_byte_size_fancy (((unsigned long long) FILESIZE) * 1000000LL / del.rel_value_us); FPRINTF (stdout, "Download speed was %s/s/n", fancy); GNUNET_free (fancy); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished download, shutting down/n", (unsigned long long) FILESIZE); } else { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Timeout during download, shutting down with error/n"); ok = 1; }}
开发者ID:claudiuolteanu,项目名称:gnunet-1,代码行数:27,
示例21: shutdown_taskstatic void shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc){ GNUNET_GNS_disconnect(gns_handle); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down peer!/n"); GNUNET_SCHEDULER_shutdown ();}
开发者ID:schanzen,项目名称:gnunet-mirror,代码行数:7,
示例22: do_waitstatic voiddo_wait (void *cls, const struct GNUNET_FS_Uri *uri, const char *fn){ struct DownloadContext *dc; if (NULL == uri) { GNUNET_SCHEDULER_shutdown (); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Timeout during upload attempt, shutting down with error/n"); ok = 1; return; } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Waiting to allow content to migrate/n"); dc = GNUNET_new (struct DownloadContext); dc->uri = GNUNET_FS_uri_dup (uri); if (NULL != fn) dc->fn = GNUNET_strdup (fn); (void) GNUNET_SCHEDULER_add_delayed (MIGRATION_DELAY, &stop_source_peer, dc);}
开发者ID:GNUnet,项目名称:gnunet,代码行数:25,
示例23: do_shutdown/** * Shutdown nicely * * @param cls NULL * @param tc the task context */static voiddo_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc){ if (GNUNET_SCHEDULER_NO_TASK != abort_task) GNUNET_SCHEDULER_cancel (abort_task); GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */}
开发者ID:schanzen,项目名称:gnunet-mirror,代码行数:13,
示例24: do_stopstatic voiddo_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc){ char *fn = cls; if (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_add (start_time, TIMEOUT)).rel_value_us) { GNUNET_break (0); ret = 1; } else { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished download, shutting down/n", (unsigned long long) FILESIZE); } if (NULL != fn) { GNUNET_DISK_directory_remove (fn); GNUNET_free (fn); } GNUNET_SCHEDULER_shutdown ();}
开发者ID:tg-x,项目名称:gnunet,代码行数:26,
示例25: info_cb/** * Function called from #GNUNET_ATS_performance_list_addresses when * we process a #CMD_LIST_ADDRESSES command. * * @param cls the `struct Command` that caused the call * @param address the address, NULL if ATS service was disconnected * @param address_active #GNUNET_YES if this address is actively used * to maintain a connection to a peer; * #GNUNET_NO if the address is not actively used; * #GNUNET_SYSERR if this address is no longer available for ATS * @param bandwidth_out assigned outbound bandwidth for the connection * @param bandwidth_in assigned inbound bandwidth for the connection * @param prop performance data for the address */static voidinfo_cb (void *cls, const struct GNUNET_HELLO_Address *address, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *prop){ struct Command *c = cls; struct CommandListAddresses *cmd = &c->details.list_addresses; if (NULL == address) { cmd->alh = NULL; /* we are done with the iteration, continue to execute */ if ( (cmd->calls < cmd->min_calls) && (cmd->active_calls < cmd->min_active_calls) ) { GNUNET_SCHEDULER_shutdown (); return; } off++; run_interpreter (); return; } switch (address_active) { case GNUNET_YES: cmd->active_calls++; cmd->calls++; break; case GNUNET_NO: cmd->calls++; break; case GNUNET_SYSERR: return; } if ( (cmd->calls > cmd->max_calls) && (cmd->active_calls < cmd->max_active_calls) ) { GNUNET_break (0); GNUNET_ATS_performance_list_addresses_cancel (cmd->alh); cmd->alh = NULL; GNUNET_SCHEDULER_shutdown (); return; }}
开发者ID:muggenhor,项目名称:GNUnet,代码行数:61,
示例26: identity_cb/** * Method called to inform about the egos of this peer. * * When used with #GNUNET_IDENTITY_connect, this function is * initially called for all egos and then again whenever a * ego's name changes or if it is deleted. At the end of * the initial pass over all egos, the function is once called * with 'NULL' for @a ego. That does NOT mean that the callback won't * be invoked in the future or that there was an error. * * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, * this function is only called ONCE, and 'NULL' being passed in * @a ego does indicate an error (i.e. name is taken or no default * value is known). If @a ego is non-NULL and if '*ctx' * is set in those callbacks, the value WILL be passed to a subsequent * call to the identity callback of #GNUNET_IDENTITY_connect (if * that one was not NULL). * * When an identity is renamed, this function is called with the * (known) @a ego but the NEW @a name. * * When an identity is deleted, this function is called with the * (known) ego and "NULL" for the @a name. In this case, * the @a ego is henceforth invalid (and the @a ctx should also be * cleaned up). * * @param cls closure * @param ego ego handle * @param ctx context for application to store data for this ego * (during the lifetime of this process, initially NULL) * @param name name assigned by the user for this ego, * NULL if the user just deleted the ego and it * must thus no longer be used */static voididentity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name){ const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key; struct GNUNET_GNSRECORD_Data rd; char *rd_string; char *peername; if (NULL == name) return; if (NULL == ego) { if (NULL == qe) { fprintf (stderr, "Failed to find master-zone ego/n"); GNUNET_SCHEDULER_shutdown (); return; } GNUNET_IDENTITY_disconnect (identity); identity = NULL; return; } GNUNET_assert (NULL != name); if (0 != strcmp (name, "master-zone")) { fprintf (stderr, "Unexpected name %s/n", name); return; } zone_key = GNUNET_IDENTITY_ego_get_private_key (ego); rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; peername = GNUNET_strdup (GNUNET_i2s_full (&id)); GNUNET_asprintf (&rd_string, "6 %s %s", peername, "www"); GNUNET_free (peername); GNUNET_assert (GNUNET_OK == GNUNET_GNSRECORD_string_to_value (GNUNET_GNSRECORD_TYPE_VPN, rd_string, (void**) &rd.data, &rd.data_size)); rd.record_type = GNUNET_GNSRECORD_TYPE_VPN; qe = GNUNET_NAMESTORE_records_store (namestore, zone_key, "www", 1, &rd, &commence_testing, NULL); GNUNET_free ((void**)rd.data); GNUNET_free (rd_string);}
开发者ID:tg-x,项目名称:gnunet,代码行数:93,
示例27: end_test/** * Function run on timeout. * * @param cls closure */static voidend_test (void *cls){ timeout_task = NULL; fprintf (stderr, "Timeout!/n"); GNUNET_SCHEDULER_shutdown ();}
开发者ID:GNUnet,项目名称:gnunet,代码行数:13,
示例28: terminate_task_errorstatic voidterminate_task_error (void *cls){ err_task = NULL; GNUNET_break (0); GNUNET_SCHEDULER_shutdown (); ok = 42;}
开发者ID:GNUnet,项目名称:gnunet,代码行数:8,
示例29: result_cb_set1static voidresult_cb_set1 (void *cls, const struct GNUNET_SET_Element *element, enum GNUNET_SET_Status status){ switch (status) { case GNUNET_SET_STATUS_ADD_LOCAL: count_set1++; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "set 1: got element/n"); break; case GNUNET_SET_STATUS_FAILURE: GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "set 1: failure/n"); oh1 = NULL; ret = 1; if (NULL != timeout_task) { GNUNET_SCHEDULER_cancel (timeout_task); timeout_task = NULL; } GNUNET_SCHEDULER_shutdown (); break; case GNUNET_SET_STATUS_DONE: oh1 = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "set 1: done/n"); GNUNET_SET_destroy (set1); set1 = NULL; if (NULL == set2) { if (NULL != timeout_task) { GNUNET_SCHEDULER_cancel (timeout_task); timeout_task = NULL; } GNUNET_SCHEDULER_shutdown (); } break; case GNUNET_SET_STATUS_ADD_REMOTE: break; default: GNUNET_assert (0); }}
开发者ID:GNUnet,项目名称:gnunet,代码行数:46,
示例30: timeout_error/** * Timeout, give up. */static voidtimeout_error (void *cls){ timeout_task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout trying to connect peers, test failed./n"); GNUNET_SCHEDULER_shutdown ();}
开发者ID:GNUnet,项目名称:gnunet,代码行数:11,
注:本文中的GNUNET_SCHEDULER_shutdown函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GNUNET_STATISTICS_update函数代码示例 C++ GNUNET_SCHEDULER_cancel函数代码示例 |