return ret;
}
-
-static ssize_t
-send_with_plugin (const struct GNUNET_PeerIdentity *target, const char *msgbuf,
- size_t msgbuf_size, uint32_t priority,
- struct GNUNET_TIME_Relative timeout, struct Session *session,
- const struct GNUNET_HELLO_Address *address, int force_address,
- GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
-{
-#if TEST_NEW_CODE
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Call to depracted function send_with_plugin\n");
-#endif
-
- struct GNUNET_TRANSPORT_PluginFunctions *papi;
- size_t ret = GNUNET_SYSERR;
-
- /* FIXME : ats returns an address with all values 0 */
- if (address == NULL)
- {
- if (cont != NULL)
- cont (cont_cls, target, GNUNET_SYSERR);
- return GNUNET_SYSERR;
- }
-
- if ((session == NULL) && (address->address_length == 0))
- {
- if (cont != NULL)
- cont (cont_cls, target, GNUNET_SYSERR);
- return GNUNET_SYSERR;
- }
-
- papi = GST_plugins_find (address->transport_name);
- if (papi == NULL)
- {
- if (cont != NULL)
- cont (cont_cls, target, GNUNET_SYSERR);
- return GNUNET_SYSERR;
- }
-
- ret =
- papi->send (papi->cls, target, msgbuf, msgbuf_size, 0, timeout, session,
- address->address, address->address_length, GNUNET_YES, cont,
- cont_cls);
-
- if (ret == -1)
- {
- if (cont != NULL)
- cont (cont_cls, target, GNUNET_SYSERR);
- }
- return ret;
-}
-
-
/**
* Task invoked to start a transmission to another peer.
*
return;
}
-#if TEST_NEW_CODE
ret = send_with_session(n,
mq->message_buf, mq->message_buf_size,
0, timeout,
&transmit_send_continuation, mq);
-#else
- ret = send_with_plugin (&n->id,
- mq->message_buf, mq->message_buf_size,
- 0, timeout,
- n->session, n->address, GNUNET_YES,
- &transmit_send_continuation, mq);
-#endif
if (ret == -1)
{
&disconnect_msg.purpose,
&disconnect_msg.signature));
-#if TEST_NEW_CODE
ret = send_with_session (n,
(const char *) &disconnect_msg, sizeof (disconnect_msg),
UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL,
&send_disconnect_cont, NULL);
-#else
- ret = send_with_plugin (&n->id,
- (const char *) &disconnect_msg, sizeof (disconnect_msg),
- UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL,
- n->session, n->address,
- GNUNET_YES, &send_disconnect_cont, NULL);
-#endif
if (ret == GNUNET_SYSERR)
return GNUNET_SYSERR;
m.size = htons (sizeof (struct GNUNET_MessageHeader));
m.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE);
-#if TEST_NEW_CODE
ret = send_with_session (n,
(const void *) &m, sizeof (m),
UINT32_MAX /* priority */ ,
GNUNET_TIME_UNIT_FOREVER_REL,
NULL, NULL);
-#else
- ret = send_with_plugin (&n->id, (const void *) &m, sizeof (m),
- UINT32_MAX /* priority */ ,
- GNUNET_TIME_UNIT_FOREVER_REL, n->session, n->address,
- GNUNET_YES, NULL, NULL);
-#endif
n->expect_latency_response = GNUNET_NO;
n->keep_alive_sent = GNUNET_TIME_absolute_get_zero ();
if (NULL != address_change_cb && n->state == S_CONNECTED)
address_change_cb (callback_cls, &n->id, n->address);
-#if TEST_NEW_CODE
/* Obtain an session for this address from plugin */
struct GNUNET_TRANSPORT_PluginFunctions *papi;
papi = GST_plugins_find (address->transport_name);
n->session, GNUNET_i2s (&n->id), GST_plugins_a2s (n->address));
n->session = session;
}
-#else
- n->session = session;
-
- /* dummy */
- if (NULL != NULL) send_with_session( NULL, NULL, 0, 0, GNUNET_TIME_relative_get_zero(), NULL, NULL);
-#endif
switch (n->state)
{
cc->session = session;
cc->address = GNUNET_HELLO_address_copy (address);
-#if TEST_NEW_CODE
- ret = send_with_session (n,
+ ret = send_with_session (n,
(const char *) &connect_msg, msg_len,
UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL,
&send_connect_continuation, cc);
-#else
- ret =
- send_with_plugin (peer, (const char *) &connect_msg, msg_len,
- UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL, session,
- address, GNUNET_YES, &send_connect_continuation, cc);
-#endif
return GNUNET_NO;
case S_CONNECT_RECV:
cc = GNUNET_malloc (sizeof (struct ContinutionContext));
cc->session = session;
cc->address = GNUNET_HELLO_address_copy (address);
-#if TEST_NEW_CODE
+
ret = send_with_session(n,
(const void *) &connect_msg, msg_len,
UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL,
&send_connect_ack_continuation,
cc);
-#else
- ret =
- send_with_plugin (&n->id, (const void *) &connect_msg, msg_len,
- UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL, session,
- address, GNUNET_YES, &send_connect_ack_continuation,
- cc);
-#endif
return GNUNET_NO;
case S_CONNECTED:
case S_FAST_RECONNECT:
cc = GNUNET_malloc (sizeof (struct ContinutionContext));
cc->session = session;
cc->address = GNUNET_HELLO_address_copy (address);
-
-#if TEST_NEW_CODE
ret = send_with_session(n,
(const void *) &connect_msg, msg_len,
UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL,
&send_switch_address_continuation, cc);
-#else
- ret =
- send_with_plugin (peer, (const char *) &connect_msg, msg_len,
- UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL, session,
- address, GNUNET_YES,
- &send_switch_address_continuation, cc);
-#endif
-
-
if (ret == GNUNET_SYSERR)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
m.size = htons (sizeof (struct GNUNET_MessageHeader));
m.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE);
-#if TEST_NEW_CODE
send_with_session(n,
(const void *) &m, sizeof (m),
UINT32_MAX,
GNUNET_TIME_UNIT_FOREVER_REL,
NULL, NULL);
-#else
- send_with_plugin (&n->id,
- (const void *) &m, sizeof (m),
- UINT32_MAX /* priority */ ,
- GNUNET_TIME_UNIT_FOREVER_REL,
- n->session, n->address,
- GNUNET_YES, NULL, NULL);
-#endif
-
-
}
/**
msg.size = htons (msg_len);
msg.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_ACK);
-#if TEST_NEW_CODE
ret = send_with_session(n,
(const char *) &msg, msg_len,
UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL,
NULL, NULL);
-#else
- ret =
- send_with_plugin (&n->id,
- (const char *) &msg, msg_len,
- UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL,
- n->session, n->address, GNUNET_YES,
- NULL, NULL);
-#endif
if (ret == GNUNET_SYSERR)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,