$(top_builddir)/src/hello/libgnunethello.la \
$(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/transport/libgnunettransport.la \
+ $(top_builddir)/src/transport/libgnunettransportnew.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL)
*/
uint32_t reserved GNUNET_PACKED;
- /**
- * When to time out.
- */
- struct GNUNET_TIME_RelativeNBO timeout;
-
/**
* Identity of the other peer.
*/
* be called with the TIMEOUT reason code.
*
* @param h core handle
- * @param timeout how long to try to talk to core
* @param peer who should we connect to
* @param cont function to call once the request has been completed (or timed out)
* @param cont_cls closure for cont
*/
struct GNUNET_CORE_PeerRequestHandle *
GNUNET_CORE_peer_request_connect (struct GNUNET_CORE_Handle *h,
- struct GNUNET_TIME_Relative timeout,
const struct GNUNET_PeerIdentity * peer,
GNUNET_CORE_ControlContinuation cont,
void *cont_cls)
struct ConnectMessage *msg;
if (NULL != GNUNET_CONTAINER_multihashmap_get (h->peers,
- &peer->hashPubKey))
+ &peer->hashPubKey))
{
#if DEBUG_CORE
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
msg->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_REQUEST_CONNECT);
msg->header.size = htons (sizeof (struct ConnectMessage));
msg->reserved = htonl (0);
- msg->timeout = GNUNET_TIME_relative_hton (timeout);
msg->peer = *peer;
GNUNET_CONTAINER_DLL_insert_tail (h->control_pending_head,
h->control_pending_tail,
}
-/**
- * Function called when the transport service is ready to
- * receive a message. Only resets 'n->th' to NULL.
- *
- * @param cls neighbour to use message from
- * @param size number of bytes we can transmit
- * @param buf where to copy the message
- * @return number of bytes transmitted
- */
-static size_t
-notify_transport_connect_done (void *cls,
- size_t size,
- void *buf)
-{
- struct Neighbour *n = cls;
-
- n->th = NULL;
- if (GNUNET_YES != n->is_connected)
- {
- /* transport should only call us to transmit a message after
- * telling us about a successful connection to the respective peer */
-#if DEBUG_CORE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Timeout on notify connect!\n");
-#endif
- GNUNET_STATISTICS_update (stats,
- gettext_noop ("# connection requests timed out in transport"),
- 1,
- GNUNET_NO);
- return 0;
- }
- if (buf == NULL)
- {
- GNUNET_STATISTICS_update (stats,
- gettext_noop ("# connection requests timed out in transport"),
- 1,
- GNUNET_NO);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Failed to connect to `%4s': transport failed to connect\n"),
- GNUNET_i2s (&n->peer));
- return 0;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("TRANSPORT connection to peer `%4s' is up, trying to establish CORE connection\n"),
- GNUNET_i2s (&n->peer));
- if (n->retry_set_key_task != GNUNET_SCHEDULER_NO_TASK)
- GNUNET_SCHEDULER_cancel (n->retry_set_key_task);
- n->retry_set_key_task = GNUNET_SCHEDULER_add_now (&set_key_retry_task,
- n);
- return 0;
-}
-
-
/**
* Handle CORE_REQUEST_CONNECT request.
*
{
const struct ConnectMessage *cm = (const struct ConnectMessage*) message;
struct Neighbour *n;
- struct GNUNET_TIME_Relative timeout;
if (0 == memcmp (&cm->peer,
&my_identity,
/* In this case a client has asked us to connect to ourselves, not really an error! */
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
- }
- timeout = GNUNET_TIME_relative_ntoh (cm->timeout);
+ }
GNUNET_break (ntohl (cm->reserved) == 0);
- GNUNET_SERVER_receive_done (client, GNUNET_OK);
- n = find_neighbour (&cm->peer);
- if (n == NULL)
- n = create_neighbour (&cm->peer);
- if ( (GNUNET_YES == n->is_connected) ||
- (n->th != NULL) )
- {
- if (GNUNET_YES == n->is_connected)
- {
- GNUNET_STATISTICS_update (stats,
- gettext_noop ("# connection requests ignored (already connected)"),
- 1,
- GNUNET_NO);
- }
- else
- {
- if (NULL != n->th)
- {
- GNUNET_TRANSPORT_notify_transmit_ready_cancel (n->th);
- n->th = NULL;
- }
- n->th = GNUNET_TRANSPORT_notify_transmit_ready (transport,
- &cm->peer,
- sizeof (struct GNUNET_MessageHeader), 0,
- timeout,
- ¬ify_transport_connect_done,
- n);
- GNUNET_break (NULL != n->th);
- GNUNET_STATISTICS_update (stats,
- gettext_noop ("# connection requests retried (due to repeat request connect)"),
- 1,
- GNUNET_NO);
- }
- return; /* already connected, or at least trying */
- }
- GNUNET_STATISTICS_update (stats,
- gettext_noop ("# connection requests received"),
- 1,
- GNUNET_NO);
-
#if DEBUG_CORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Core received `%s' request for `%4s', will try to establish connection\n",
"REQUEST_CONNECT",
GNUNET_i2s (&cm->peer));
#endif
-
- /* ask transport to connect to the peer */
- n->th = GNUNET_TRANSPORT_notify_transmit_ready (transport,
- &cm->peer,
- sizeof (struct GNUNET_MessageHeader), 0,
- timeout,
- ¬ify_transport_connect_done,
- n);
- GNUNET_break (NULL != n->th);
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# connection requests received"),
+ 1,
+ GNUNET_NO);
+ GNUNET_SERVER_receive_done (client, GNUNET_OK);
+ n = find_neighbour (&cm->peer);
+ if ( (n == NULL) ||
+ (GNUNET_YES != n->is_connected) )
+ {
+ GNUNET_TRANSPORT_try_connect (transport,
+ &cm->peer);
+ }
+ else
+ {
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# connection requests ignored (already connected)"),
+ 1,
+ GNUNET_NO);
+ }
}
"Asking core (1) to connect to peer `%4s'\n",
GNUNET_i2s (&p2.id));
GNUNET_CORE_peer_request_connect (p1.ch,
- GNUNET_TIME_UNIT_SECONDS,
&p2.id,
NULL, NULL);
}
"Asking core (1) AGAIN to connect to peer `%4s'\n",
GNUNET_i2s (&p2.id));
GNUNET_CORE_peer_request_connect (p1.ch,
- GNUNET_TIME_UNIT_SECONDS,
&p2.id,
NULL, NULL);
}
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
&ask_connect_task, NULL);
GNUNET_CORE_peer_request_connect (p1.ch,
- GNUNET_TIME_UNIT_SECONDS,
&p2.id,
NULL, NULL);
}
"Asking core (1) to connect to peer `%4s'\n",
GNUNET_i2s (&p2.id));
GNUNET_CORE_peer_request_connect (p1.ch,
- GNUNET_TIME_UNIT_SECONDS,
&p2.id,
NULL, NULL);
}
GNUNET_i2s (&p2.id));
#endif
GNUNET_CORE_peer_request_connect (p1.ch,
- GNUNET_TIME_UNIT_SECONDS,
&p2.id,
NULL, NULL);
}
increment_stats (STAT_HELLOS_PROVIDED);
GNUNET_TRANSPORT_offer_hello (transport_handle, hello_msg, NULL, NULL);
GNUNET_CORE_peer_request_connect (coreAPI,
- GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 5),
&new_peer, NULL, NULL);
}
}
increment_stats (STAT_HELLOS_PROVIDED);
GNUNET_TRANSPORT_offer_hello (transport_handle, other_hello, NULL, NULL);
GNUNET_CORE_peer_request_connect (coreAPI,
- GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 5),
&peer_id, NULL, NULL);
route_message (find_msg, msg_ctx);
GNUNET_free (other_hello);
* be called with the TIMEOUT reason code.
*
* @param h core handle
- * @param timeout how long to try to talk to core
* @param peer who should we connect to
* @param cont function to call once the request has been completed (or timed out)
* @param cont_cls closure for cont
*/
struct GNUNET_CORE_PeerRequestHandle *
GNUNET_CORE_peer_request_connect (struct GNUNET_CORE_Handle *h,
- struct GNUNET_TIME_Relative timeout,
const struct GNUNET_PeerIdentity * peer,
GNUNET_CORE_ControlContinuation cont,
void *cont_cls);
handle->pending_tunnels.tail,
tunnel);
(void) GNUNET_CORE_peer_request_connect (handle->core,
- timeout,
peers,
NULL, NULL);
}
GNUNET_assert (ctx->d1core != NULL);
ctx->connect_request_handle =
GNUNET_CORE_peer_request_connect (ctx->d1core,
- ctx->relative_timeout,
&ctx->d2->id,
&core_connect_request_cont, ctx);
{
connect_ctx->connect_request_handle =
GNUNET_CORE_peer_request_connect (connect_ctx->d1core,
- connect_ctx->relative_timeout,
&connect_ctx->d2->id,
&core_connect_request_cont, connect_ctx);
GNUNET_assert(connect_ctx->connect_request_handle != NULL);
{
ctx->connect_request_handle =
GNUNET_CORE_peer_request_connect (ctx->d1core,
- ctx->relative_timeout,
&ctx->d2->id,
&core_connect_request_cont, ctx);
}
while (conn != NULL)
{
GNUNET_CORE_peer_request_connect(send_hello_context->peer->daemon->server,
- GNUNET_TIME_relative_get_forever(),
&send_hello_context->pg->peers[conn->index].daemon->id,
NULL,
NULL);
/**
- * Function called by core when our attempt to connect succeeded.
+ * Function called by core when our request to connect was transmitted.
*
* @param cls the 'struct Peer' for which we issued the connect request
* @param success was the request transmitted
1,
GNUNET_NO);
pos->connect_req = GNUNET_CORE_peer_request_connect (handle,
- GNUNET_TIME_UNIT_MINUTES,
&pos->pid,
&connect_completed_callback,
pos);
process_peer (void *cls,
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_HELLO_Message *hello,
- const char *err_msg)
+ const char *err_msg)
{
struct Peer *pos;