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

C++ GNUNET_SCHEDULER_cancel函数代码示例

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

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



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

示例1: end_badly

static void
end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  if (send_task != GNUNET_SCHEDULER_NO_TASK)
  {
    GNUNET_SCHEDULER_cancel (send_task);
    send_task = GNUNET_SCHEDULER_NO_TASK;
  }

  if (shutdown_task != GNUNET_SCHEDULER_NO_TASK)
  {
    GNUNET_SCHEDULER_cancel (shutdown_task);
    shutdown_task = GNUNET_SCHEDULER_NO_TASK;
  }

  if (cc != NULL)
  {
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Fail! Could not connect peers\n"));
    GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc);
    cc = NULL;
  }

  if (th != NULL)
    GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
  th = NULL;

  if (blacklist_p1 != NULL)
    GNUNET_TRANSPORT_blacklist_cancel (blacklist_p1);

  if (blacklist_p2 != NULL)
    GNUNET_TRANSPORT_blacklist_cancel (blacklist_p2);

  if (p1 != NULL)
    GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
  if (p2 != NULL)
    GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2);

  ok = GNUNET_SYSERR;
}
开发者ID:claudiuolteanu,项目名称:gnunet,代码行数:39,代码来源:test_transport_api_blacklisting.c


示例2: GNUNET_SPEEDUP_stop_

/**
 * Stop tasks that modify clock behavior.
 */
void
GNUNET_SPEEDUP_stop_ ()
{
  if (NULL != speedup_task)
  {
    GNUNET_SCHEDULER_cancel (speedup_task);
    speedup_task = NULL;
  }
  if ( (0 != interval.rel_value_us) &&
       (0 != delta.rel_value_us) )
    LOG (GNUNET_ERROR_TYPE_DEBUG,
	 "Stopped execution speed up\n");
}
开发者ID:muggenhor,项目名称:GNUnet,代码行数:16,代码来源:speedup.c


示例3: end

static void
end ()
{
  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");

  if (timer_task != NULL)
  {
    GNUNET_SCHEDULER_cancel (timer_task);
    timer_task = NULL;
  }

  if (die_task != NULL)
  {
    GNUNET_SCHEDULER_cancel (die_task);
    die_task = NULL;
  }

  if (th != NULL)
    GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
  th = NULL;


  GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
  GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2);

  if (disconnects == 0)
    ok = 0;
  else
  {
    ok = disconnects;
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                "Fail! Had %u disconnects while waiting %s\n",
                disconnects,
		GNUNET_STRINGS_relative_time_to_string (WAIT,
							GNUNET_YES));
  }

  GNUNET_TRANSPORT_TESTING_done (tth);
}
开发者ID:tg-x,项目名称:gnunet,代码行数:39,代码来源:test_transport_api_timeout.c


示例4: end_badly

static void
end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  die_task = GNUNET_SCHEDULER_NO_TASK;

  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n");

  if (restarted == GNUNET_YES)
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peer was restarted\n");

  if (restarted == GNUNET_NO)
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peer was NOT restarted\n");

  if (reconnect_task != GNUNET_SCHEDULER_NO_TASK)
    GNUNET_SCHEDULER_cancel (reconnect_task);
  reconnect_task = GNUNET_SCHEDULER_NO_TASK;

  if (send_task != GNUNET_SCHEDULER_NO_TASK)
    GNUNET_SCHEDULER_cancel (send_task);
  send_task = GNUNET_SCHEDULER_NO_TASK;

  if (cc != NULL)
  {
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Fail! Could not connect peers\n"));
    GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc);
    cc = NULL;
  }

  if (th != NULL)
    GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
  th = NULL;

  if (p1 != NULL)
    GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
  if (p2 != NULL)
    GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2);

  ok = GNUNET_SYSERR;
}
开发者ID:amatus,项目名称:gnunet-debian,代码行数:39,代码来源:test_transport_api_restart_1peer.c


示例5: do_abort

/**
 * Something went wrong and timed out. Kill everything and set error flag
 */
static void
do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ABORT\n");
  result = GNUNET_SYSERR;
  abort_task = NULL;
  if (NULL != shutdown_task)
  {
    GNUNET_SCHEDULER_cancel (shutdown_task);
    shutdown_task = NULL;
  }
  do_shutdown (cls, tc);
}
开发者ID:tg-x,项目名称:gnunet,代码行数:16,代码来源:test_cadet_local.c


示例6: GNUNET_TESTBED_LOGGER_flush_cancel

/**
 * Cancel notification upon flush.  Should only be used when the flush
 * completion callback given to GNUNET_TESTBED_LOGGER_flush() is not already
 * called.
 *
 * @param h the logger handle
 */
void
GNUNET_TESTBED_LOGGER_flush_cancel (struct GNUNET_TESTBED_LOGGER_Handle *h)
{
  if (GNUNET_SCHEDULER_NO_TASK != h->flush_completion_task)
  {
    GNUNET_SCHEDULER_cancel (h->flush_completion_task);
    h->flush_completion_task = GNUNET_SCHEDULER_NO_TASK;
  }
  if (GNUNET_SCHEDULER_NO_TASK != h->timeout_flush_task)
    cancel_timeout_flush (h);
  h->cb = NULL;
  h->cb_cls = NULL;
}
开发者ID:claudiuolteanu,项目名称:gnunet-1,代码行数:20,代码来源:testbed_logger_api.c


示例7: end_badly

static void
end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  die_task = NULL;

  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n");


  if (send_task != NULL)
    GNUNET_SCHEDULER_cancel (send_task);

  if (cc != NULL)
  {
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Fail! Could not connect peers\n"));
    GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc);
    cc = NULL;
  }

  if (th != NULL)
    GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
  else
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peer were not ready to send data\n"));

  if (s_started == GNUNET_NO)
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peers were not started \n"));
  else
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peers were started \n"));

  if (s_connected == GNUNET_NO)
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peer were not connected\n"));
  else
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peer were connected\n"));

  if (s_sending == GNUNET_NO)
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peer were not ready to send data\n"));
  else
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peer were ready to send data\n"));

  th = NULL;

  if (p1 != NULL)
    GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
  else
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peer 1 was not started\n"));
  if (p2 != NULL)
    GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2);
  else
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Peer 2 was not started\n"));

  ok = GNUNET_SYSERR;
}
开发者ID:muggenhor,项目名称:GNUnet,代码行数:51,代码来源:test_transport_api_manipulation_recv_tcp.c


示例8: GNUNET_CONNECTION_notify_transmit_ready

/**
 * Ask the connection to call us once the specified number of bytes
 * are free in the transmission buffer.  May call the notify
 * method immediately if enough space is available.
 *
 * @param connection connection
 * @param size number of bytes to send
 * @param timeout after how long should we give up (and call
 *        notify with buf NULL and size 0)?
 * @param notify function to call
 * @param notify_cls closure for notify
 * @return non-NULL if the notify callback was queued,
 *         NULL if we are already going to notify someone else (busy)
 */
struct GNUNET_CONNECTION_TransmitHandle *
GNUNET_CONNECTION_notify_transmit_ready (struct GNUNET_CONNECTION_Handle *connection,
                                         size_t size,
                                         struct GNUNET_TIME_Relative timeout,
                                         GNUNET_CONNECTION_TransmitReadyNotify
                                         notify, void *notify_cls)
{
  if (NULL != connection->nth.notify_ready)
  {
    GNUNET_assert (0);
    return NULL;
  }
  GNUNET_assert (NULL != notify);
  GNUNET_assert (size < GNUNET_SERVER_MAX_MESSAGE_SIZE);
  GNUNET_assert (connection->write_buffer_off <= connection->write_buffer_size);
  GNUNET_assert (connection->write_buffer_pos <= connection->write_buffer_size);
  GNUNET_assert (connection->write_buffer_pos <= connection->write_buffer_off);
  connection->nth.notify_ready = notify;
  connection->nth.notify_ready_cls = notify_cls;
  connection->nth.connection = connection;
  connection->nth.notify_size = size;
  connection->nth.transmit_timeout = GNUNET_TIME_relative_to_absolute (timeout);
  GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == connection->nth.timeout_task);
  if ((NULL == connection->sock) && 
      (NULL == connection->ap_head) &&
      (NULL == connection->dns_active))
  {
    if (GNUNET_SCHEDULER_NO_TASK != connection->write_task)
      GNUNET_SCHEDULER_cancel (connection->write_task);
    connection->write_task = GNUNET_SCHEDULER_add_now (&connect_error, connection);
    return &connection->nth;
  }
  if (GNUNET_SCHEDULER_NO_TASK != connection->write_task)
    return &connection->nth; /* previous transmission still in progress */
  if (NULL != connection->sock)
  {
    /* connected, try to transmit now */
    LOG (GNUNET_ERROR_TYPE_DEBUG, "Scheduling transmission (%p).\n", connection);
    connection->write_task =
        GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_absolute_get_remaining
                                        (connection->nth.transmit_timeout),
                                        connection->sock, &transmit_ready, connection);
    return &connection->nth;
  }
  /* not yet connected, wait for connection */
  LOG (GNUNET_ERROR_TYPE_DEBUG,
       "Need to wait to schedule transmission for connection, adding timeout task (%p).\n", connection);
  connection->nth.timeout_task =
    GNUNET_SCHEDULER_add_delayed (timeout, &transmit_timeout, connection);
  return &connection->nth;
}
开发者ID:h4ck3rm1k3,项目名称:gnunet-debian,代码行数:65,代码来源:connection.c


示例9: on_lookup_result

/**
 * Function called on result for a GNS lookup
 *
 * @param cls closure, unused
 * @param rd_count number of records
 * @param rd the records in reply
 */
static void
on_lookup_result(void *cls, uint32_t rd_count,
                 const struct GNUNET_NAMESTORE_RecordData *rd)
{
  struct in_addr a;
  uint32_t i;
  char* addr;

  lr = NULL;
  if (GNUNET_SCHEDULER_NO_TASK != die_task)
  {
      GNUNET_SCHEDULER_cancel (die_task);
      die_task = GNUNET_SCHEDULER_NO_TASK;
  }
  GNUNET_NAMESTORE_disconnect (namestore_handle);
  namestore_handle = NULL;
  if (rd_count == 0)
  {
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                "Lookup failed, rp_filtering?\n");
    ok = 2;
  }
  else
  {
    ok = 1;
    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "name: %s\n", (char*)cls);
    for (i=0; i<rd_count; i++)
    {
      GNUNET_log (GNUNET_ERROR_TYPE_INFO, "type: %d\n", rd[i].record_type);
      if (rd[i].record_type == GNUNET_GNS_RECORD_A)
      {
        memcpy (&a, rd[i].data, sizeof(a));
        addr = inet_ntoa(a);
        GNUNET_log (GNUNET_ERROR_TYPE_INFO, "address: %s\n", addr);
        if (0 == strcmp (addr, TEST_IP))
        {
          GNUNET_log (GNUNET_ERROR_TYPE_INFO,
		      "%s correctly resolved to %s!\n",
		      TEST_DOMAIN, addr);
          ok = 0;
        }
      }
      else
      {
        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
		    "No resolution!\n");
      }
    }
  }
  GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
}
开发者ID:amatus,项目名称:gnunet-debian,代码行数:58,代码来源:test_gns_simple_lookup.c


示例10: end_badly

/**
 * Check if the get_handle is being used, if so stop the request.  Either
 * way, schedule the end_badly_cont function which actually shuts down the
 * test.
 */
static void
end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  die_task = GNUNET_SCHEDULER_NO_TASK;
  int c;

  if (GNUNET_SCHEDULER_NO_TASK != wait_task)
  {
      GNUNET_SCHEDULER_cancel (wait_task);
      wait_task = GNUNET_SCHEDULER_NO_TASK;
  }

  for (c = 0; c < 3; c++)
  {
    if (NULL != nh[c])
    {
      GNUNET_NAMESTORE_disconnect(nh[c]);
      nh[c] = NULL;
    }

    if (NULL != get_cfg_ops[c])
    {
        GNUNET_TESTBED_operation_done(get_cfg_ops[c]);
        get_cfg_ops[c] = NULL;
    }
    if (NULL != cfg_handles[c])
    {
      GNUNET_CONFIGURATION_destroy (cfg_handles[c]);
      cfg_handles[c] = NULL;
    }
  }
  if (NULL != topology_op)
  {
    GNUNET_TESTBED_operation_done (topology_op);
    topology_op = NULL;
  }
  if (NULL != lookup_handle)
  {
    GNUNET_GNS_cancel_lookup_request (lookup_handle);
    lookup_handle = NULL;
  }
  if (NULL != gh)
  {
    GNUNET_GNS_disconnect(gh);
    gh = NULL;
  }
  
  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Test failed \n");
  GNUNET_SCHEDULER_shutdown ();
  ok = 1;
}
开发者ID:amatus,项目名称:gnunet-debian,代码行数:56,代码来源:test_gns_dht_three_peers.c


示例11: GNUNET_NAT_mini_map_stop

/**
 * Remove a mapping created with (mini)upnpc.  Calling
 * this function will give 'upnpc' 1s to remove tha mapping,
 * so while this function is non-blocking, a task will be
 * left with the scheduler for up to 1s past this call.
 *
 * @param mini the handle
 */
void
GNUNET_NAT_mini_map_stop (struct GNUNET_NAT_MiniHandle *mini)
{
  char pstr[6];

  if (NULL != mini->refresh_task)
  {
    GNUNET_SCHEDULER_cancel (mini->refresh_task);
    mini->refresh_task = NULL;
  }
  if (NULL != mini->refresh_cmd)
  {
    GNUNET_OS_command_stop (mini->refresh_cmd);
    mini->refresh_cmd = NULL;
  }
  if (NULL != mini->map_cmd)
  {
    GNUNET_OS_command_stop (mini->map_cmd);
    mini->map_cmd = NULL;
  }
  if (GNUNET_NO == mini->did_map)
  {
    GNUNET_free (mini);
    return;
  }
  mini->ac (mini->ac_cls,
	    GNUNET_NO,
            (const struct sockaddr *) &mini->current_addr,
            sizeof (mini->current_addr),
            GNUNET_NAT_ERROR_SUCCESS);
  /* Note: oddly enough, deletion uses the external port whereas
   * addition uses the internal port; this rarely matters since they
   * often are the same, but it might... */
  GNUNET_snprintf (pstr,
                   sizeof (pstr),
                   "%u",
                   (unsigned int) ntohs (mini->current_addr.sin_port));
  LOG (GNUNET_ERROR_TYPE_DEBUG,
       "Unmapping port %u with UPnP\n",
       ntohs (mini->current_addr.sin_port));
  mini->unmap_cmd 
    = GNUNET_OS_command_run (&process_unmap_output,
			     mini,
			     UNMAP_TIMEOUT,
                             "upnpc",
			     "upnpc",
			     "-d",
			     pstr,
                             mini->is_tcp ? "tcp" : "udp",
			     NULL);
}
开发者ID:GNUnet,项目名称:gnunet,代码行数:59,代码来源:gnunet-service-nat_mini.c


示例12: put_cont

static void
put_cont (void *cls, int32_t success, const char *emsg)
{
  static int c = 0;

  if (success == GNUNET_OK)
  {
    c++;
    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record %u \n", c);
  }
  else
  {
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to created records\n");
    GNUNET_break (0);
    GNUNET_SCHEDULER_cancel (endbadly_task);
    endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
  }

  if (c == 3)
  {
    res = 1;
    returned_records = 0;
    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All records created, starting iteration over all zones \n");
    zi = GNUNET_NAMESTORE_zone_iteration_start(nsh,
                                        NULL,
                                        GNUNET_NAMESTORE_RF_NONE,
                                        GNUNET_NAMESTORE_RF_NONE,
                                        zone_proc,
                                        &zone);
    if (zi == NULL)
    {
      GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to create zone iterator\n");
      GNUNET_break (0);
      GNUNET_SCHEDULER_cancel (endbadly_task);
      endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
    }
  }
}
开发者ID:schanzen,项目名称:gnunet-mirror,代码行数:38,代码来源:test_namestore_api_zone_iteration_stop.c


示例13: end

static void
end ()
{
  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
	      "Stopping peers\n");

  if (timeout_task != NULL)
    GNUNET_SCHEDULER_cancel (timeout_task);

  GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
  GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2);

  GNUNET_TRANSPORT_TESTING_done (tth);
}
开发者ID:muggenhor,项目名称:GNUnet,代码行数:14,代码来源:test_transport_testing.c


示例14: handle_announce

/**
 * Handle ANNOUNCE message.
 *
 * @param cls closure
 * @param client identification of the client
 * @param message the actual message
 */
static void
handle_announce (void *cls,
		 struct GNUNET_SERVER_Client *client,
		 const struct GNUNET_MessageHeader *message)
{
  const struct AnnounceMessage *am;
  const char *regex;
  struct ClientEntry *ce;
  uint16_t size;

  size = ntohs (message->size);
  am = (const struct AnnounceMessage *) message;
  regex = (const char *) &am[1];
  if ( (size <= sizeof (struct AnnounceMessage)) ||
       ('\0' != regex[size - sizeof (struct AnnounceMessage) - 1]) )
  {
    GNUNET_break (0);
    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
    return;
  }

  ce = GNUNET_new (struct ClientEntry);
  ce->client = client;
  ce->frequency = GNUNET_TIME_relative_ntoh (am->refresh_delay);
  ce->refresh_task = GNUNET_SCHEDULER_add_delayed (ce->frequency,
						   &reannounce,
						   ce);
  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
	      "Starting to announce regex `%s' every %s\n",
	      regex,
	      GNUNET_STRINGS_relative_time_to_string (ce->frequency,
						      GNUNET_NO));
  ce->ah = REGEX_INTERNAL_announce (dht,
				    my_private_key,
				    regex,
				    ntohs (am->compression),
				    stats);
  if (NULL == ce->ah)
  {
    GNUNET_break (0);
    GNUNET_SCHEDULER_cancel (ce->refresh_task);
    GNUNET_free (ce);
    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
    return;
  }
  GNUNET_CONTAINER_DLL_insert (client_head,
			       client_tail,
			       ce);
  GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
开发者ID:GNUnet,项目名称:gnunet,代码行数:57,代码来源:gnunet-service-regex.c


示例15: abort_publish_task

static void
abort_publish_task (void *cls)
{
  if (NULL != publish)
  {
    GNUNET_FS_publish_stop (publish);
    publish = NULL;
  }
  if (NULL != timeout_task)
  {
    GNUNET_SCHEDULER_cancel (timeout_task);
    timeout_task = NULL;
  }
}
开发者ID:GNUnet,项目名称:gnunet,代码行数:14,代码来源:test_fs_search.c


示例16: receive

static int
receive (void *cls, const struct GNUNET_PeerIdentity *other,
         const struct GNUNET_MessageHeader *message)
{
  if (die_task != GNUNET_SCHEDULER_NO_TASK)
    GNUNET_SCHEDULER_cancel (die_task);
  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received message from peer %s\n",
              GNUNET_i2s (other));
  GNUNET_assert (GNUNET_MESSAGE_TYPE_DUMMY == ntohs (message->type));
  GNUNET_assert (0 == memcmp (other, &myself, sizeof (myself)));
  GNUNET_SCHEDULER_add_now (&cleanup, NULL);
  ret = 0;
  return GNUNET_OK;
}
开发者ID:claudiuolteanu,项目名称:gnunet-1,代码行数:14,代码来源:test_core_api_send_to_self.c


示例17: reschedule_session_timeout

/**
 * Increment session timeout due to activity
 */
static void
reschedule_session_timeout (struct Session *s)
{
  GNUNET_assert (NULL != s);
  GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != s->timeout_task);

  GNUNET_SCHEDULER_cancel (s->timeout_task);
  s->timeout_task =  GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
                                                   &session_timeout,
                                                   s);

  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Timeout rescheduled for session %p set to %llu\n",
      s, GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value);
}
开发者ID:h4ck3rm1k3,项目名称:gnunet-debian,代码行数:17,代码来源:plugin_transport_http.c


示例18: notify_connect

/**
 * Function called to notify transport users that another
 * peer connected to us.
 *
 * @param cls closure
 * @param peer the peer that connected
 * @param latency current latency of the connection
 * @param distance in overlay hops, as given by transport plugin
 */
static void
notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
{
  if (peer == NULL)
    return;
  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected, shutting down.\n");
  ok = 0;
  if (timeout_task != GNUNET_SCHEDULER_NO_TASK)
  {
    GNUNET_SCHEDULER_cancel (timeout_task);
    timeout_task = GNUNET_SCHEDULER_NO_TASK;
  }
  GNUNET_SCHEDULER_add_now (&clean_up, NULL);
}
开发者ID:claudiuolteanu,项目名称:gnunet-1,代码行数:23,代码来源:test_gnunet_daemon_hostlist.c


示例19: GNUNET_RESOLVER_hostname_get

/**
 * Get an IP address as a string.
 *
 * @param sa host address
 * @param salen length of host address
 * @param do_resolve use GNUNET_NO to return numeric hostname
 * @param timeout how long to try resolving
 * @param callback function to call with hostnames
 *        last callback is NULL when finished
 * @param cls closure for callback
 * @return handle that can be used to cancel the request
 */
struct GNUNET_RESOLVER_RequestHandle *
GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa, socklen_t salen,
                              int do_resolve,
                              struct GNUNET_TIME_Relative timeout,
                              GNUNET_RESOLVER_HostnameCallback callback,
                              void *cls)
{
  struct GNUNET_RESOLVER_RequestHandle *rh;
  size_t ip_len;
  const void *ip;

  check_config ();
  switch (sa->sa_family)
  {
  case AF_INET:
    ip_len = sizeof (struct in_addr);
    ip = &((const struct sockaddr_in*)sa)->sin_addr;
    break;
  case AF_INET6:
    ip_len = sizeof (struct in6_addr);
    ip = &((const struct sockaddr_in6*)sa)->sin6_addr;
    break;
  default:
    GNUNET_break (0);
    return NULL;
  }
  rh = GNUNET_malloc (sizeof (struct GNUNET_RESOLVER_RequestHandle) + salen);
  rh->name_callback = callback;
  rh->cls = cls;
  rh->af = sa->sa_family;
  rh->timeout = GNUNET_TIME_relative_to_absolute (timeout);
  memcpy (&rh[1], ip, ip_len);
  rh->data_len = ip_len;
  rh->direction = GNUNET_YES;
  rh->received_response = GNUNET_NO;
  if (GNUNET_NO == do_resolve)
  {
    rh->task = GNUNET_SCHEDULER_add_now (&numeric_reverse, rh);
    return rh;
  }
  GNUNET_CONTAINER_DLL_insert_tail (req_head, req_tail, rh);
  rh->was_queued = GNUNET_YES;
  if (s_task != GNUNET_SCHEDULER_NO_TASK)
  {
    GNUNET_SCHEDULER_cancel (s_task);
    s_task = GNUNET_SCHEDULER_NO_TASK;
  }
  process_requests ();
  return rh;
}
开发者ID:amatus,项目名称:gnunet-debian,代码行数:62,代码来源:resolver_api.c


示例20: end

static void
end ()
{
  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");

  if (send_task != NULL)
  {
    GNUNET_SCHEDULER_cancel (send_task);
    send_task = NULL;
  }

  if (die_task != NULL)
    GNUNET_SCHEDULER_cancel (die_task);

  if (NULL != th)
  {
    GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
    th = NULL;
  }

  GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
  GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2);
}
开发者ID:tg-x,项目名称:gnunet,代码行数:23,代码来源:test_transport_api_bidirectional_connect.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GNUNET_SCHEDULER_shutdown函数代码示例发布时间:2022-05-30
下一篇:
C++ GNUNET_SCHEDULER_add_now函数代码示例发布时间: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