diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-10-18 21:02:16 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-10-18 21:02:16 +0000 |
commit | 75e1efb22d791bd28be6acbc19dbcdfbd737c173 (patch) | |
tree | 4829ceda8ffe7929c7f2e2cfb7adb008e2f4d4b5 /src/transport/transport_api.c | |
parent | 44cb69974fb8fa57c4e367af070a6d7bfcda8d7d (diff) | |
download | gnunet-75e1efb22d791bd28be6acbc19dbcdfbd737c173.tar.gz gnunet-75e1efb22d791bd28be6acbc19dbcdfbd737c173.zip |
-remove deprecated try_disconnect API
Diffstat (limited to 'src/transport/transport_api.c')
-rw-r--r-- | src/transport/transport_api.c | 158 |
1 files changed, 0 insertions, 158 deletions
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 502968553..e84ef9898 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -246,49 +246,6 @@ struct GNUNET_TRANSPORT_TryConnectHandle | |||
246 | 246 | ||
247 | 247 | ||
248 | /** | 248 | /** |
249 | * Entry in linked list for all try-disconnect requests | ||
250 | */ | ||
251 | struct GNUNET_TRANSPORT_TryDisconnectHandle | ||
252 | { | ||
253 | /** | ||
254 | * For the DLL. | ||
255 | */ | ||
256 | struct GNUNET_TRANSPORT_TryDisconnectHandle *prev; | ||
257 | |||
258 | /** | ||
259 | * For the DLL. | ||
260 | */ | ||
261 | struct GNUNET_TRANSPORT_TryDisconnectHandle *next; | ||
262 | |||
263 | /** | ||
264 | * Peer we should try to connect to. | ||
265 | */ | ||
266 | struct GNUNET_PeerIdentity pid; | ||
267 | |||
268 | /** | ||
269 | * Transport service handle this request is part of. | ||
270 | */ | ||
271 | struct GNUNET_TRANSPORT_Handle *th; | ||
272 | |||
273 | /** | ||
274 | * Message transmission request to communicate to service. | ||
275 | */ | ||
276 | struct GNUNET_TRANSPORT_TransmitHandle *tth; | ||
277 | |||
278 | /** | ||
279 | * Function to call upon completion (of request transmission). | ||
280 | */ | ||
281 | GNUNET_TRANSPORT_TryDisconnectCallback cb; | ||
282 | |||
283 | /** | ||
284 | * Closure for @e cb. | ||
285 | */ | ||
286 | void *cb_cls; | ||
287 | |||
288 | }; | ||
289 | |||
290 | |||
291 | /** | ||
292 | * Entry in linked list for all offer-HELLO requests. | 249 | * Entry in linked list for all offer-HELLO requests. |
293 | */ | 250 | */ |
294 | struct GNUNET_TRANSPORT_OfferHelloHandle | 251 | struct GNUNET_TRANSPORT_OfferHelloHandle |
@@ -409,16 +366,6 @@ struct GNUNET_TRANSPORT_Handle | |||
409 | struct GNUNET_TRANSPORT_TryConnectHandle *tc_tail; | 366 | struct GNUNET_TRANSPORT_TryConnectHandle *tc_tail; |
410 | 367 | ||
411 | /** | 368 | /** |
412 | * Linked list of pending try disconnect requests head | ||
413 | */ | ||
414 | struct GNUNET_TRANSPORT_TryDisconnectHandle *td_head; | ||
415 | |||
416 | /** | ||
417 | * Linked list of pending try connect requests tail | ||
418 | */ | ||
419 | struct GNUNET_TRANSPORT_TryDisconnectHandle *td_tail; | ||
420 | |||
421 | /** | ||
422 | * Linked list of pending offer HELLO requests head | 369 | * Linked list of pending offer HELLO requests head |
423 | */ | 370 | */ |
424 | struct GNUNET_TRANSPORT_OfferHelloHandle *oh_head; | 371 | struct GNUNET_TRANSPORT_OfferHelloHandle *oh_head; |
@@ -1501,111 +1448,6 @@ GNUNET_TRANSPORT_try_connect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle *t | |||
1501 | 1448 | ||
1502 | 1449 | ||
1503 | /** | 1450 | /** |
1504 | * Send #GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_DISCONNECT message to the | ||
1505 | * service. | ||
1506 | * | ||
1507 | * @param cls the `struct GNUNET_TRANSPORT_TryDisconnectHandle` | ||
1508 | * @param size number of bytes available in @a buf | ||
1509 | * @param buf where to copy the message | ||
1510 | * @return number of bytes copied to @a buf | ||
1511 | */ | ||
1512 | static size_t | ||
1513 | send_try_disconnect (void *cls, | ||
1514 | size_t size, | ||
1515 | void *buf) | ||
1516 | { | ||
1517 | struct GNUNET_TRANSPORT_TryDisconnectHandle *tdh = cls; | ||
1518 | struct TransportRequestConnectMessage msg; | ||
1519 | |||
1520 | tdh->th = NULL; | ||
1521 | if (NULL == buf) | ||
1522 | { | ||
1523 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1524 | "Discarding `%s' request to `%s' due to error in transport service connection.\n", | ||
1525 | "REQUEST_DISCONNECT", | ||
1526 | GNUNET_i2s (&tdh->pid)); | ||
1527 | if (NULL != tdh->cb) | ||
1528 | tdh->cb (tdh->cb_cls, | ||
1529 | GNUNET_SYSERR); | ||
1530 | GNUNET_TRANSPORT_try_disconnect_cancel (tdh); | ||
1531 | return 0; | ||
1532 | } | ||
1533 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1534 | "Transmitting `%s' request with respect to `%s'.\n", | ||
1535 | "REQUEST_DISCONNECT", | ||
1536 | GNUNET_i2s (&tdh->pid)); | ||
1537 | GNUNET_assert (size >= sizeof (struct TransportRequestDisconnectMessage)); | ||
1538 | msg.header.size = htons (sizeof (struct TransportRequestDisconnectMessage)); | ||
1539 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_DISCONNECT); | ||
1540 | msg.reserved = htonl (0); | ||
1541 | msg.peer = tdh->pid; | ||
1542 | memcpy (buf, &msg, sizeof (msg)); | ||
1543 | if (NULL != tdh->cb) | ||
1544 | tdh->cb (tdh->cb_cls, GNUNET_OK); | ||
1545 | GNUNET_TRANSPORT_try_disconnect_cancel (tdh); | ||
1546 | return sizeof (struct TransportRequestDisconnectMessage); | ||
1547 | } | ||
1548 | |||
1549 | |||
1550 | /** | ||
1551 | * Ask the transport service to shutdown a connection to | ||
1552 | * the given peer. | ||
1553 | * | ||
1554 | * @param handle connection to transport service | ||
1555 | * @param target who we should try to connect to | ||
1556 | * @param cb callback to be called when request was transmitted to transport | ||
1557 | * service | ||
1558 | * @param cb_cls closure for the callback @a cb | ||
1559 | * @return a `struct GNUNET_TRANSPORT_TryDisconnectHandle` handle or | ||
1560 | * NULL on failure (cb will not be called) | ||
1561 | */ | ||
1562 | struct GNUNET_TRANSPORT_TryDisconnectHandle * | ||
1563 | GNUNET_TRANSPORT_try_disconnect (struct GNUNET_TRANSPORT_Handle *handle, | ||
1564 | const struct GNUNET_PeerIdentity *target, | ||
1565 | GNUNET_TRANSPORT_TryDisconnectCallback cb, | ||
1566 | void *cb_cls) | ||
1567 | { | ||
1568 | struct GNUNET_TRANSPORT_TryDisconnectHandle *tdh; | ||
1569 | |||
1570 | if (NULL == handle->client) | ||
1571 | return NULL; | ||
1572 | tdh = GNUNET_new (struct GNUNET_TRANSPORT_TryDisconnectHandle); | ||
1573 | tdh->th = handle; | ||
1574 | tdh->pid = *target; | ||
1575 | tdh->cb = cb; | ||
1576 | tdh->cb_cls = cb_cls; | ||
1577 | tdh->tth = schedule_control_transmit (handle, | ||
1578 | sizeof (struct TransportRequestDisconnectMessage), | ||
1579 | &send_try_disconnect, tdh); | ||
1580 | GNUNET_CONTAINER_DLL_insert (handle->td_head, | ||
1581 | handle->td_tail, | ||
1582 | tdh); | ||
1583 | return tdh; | ||
1584 | } | ||
1585 | |||
1586 | |||
1587 | /** | ||
1588 | * Cancel the request to transport to try a disconnect | ||
1589 | * Callback will not be called | ||
1590 | * | ||
1591 | * @param tdh the handle to cancel | ||
1592 | */ | ||
1593 | void | ||
1594 | GNUNET_TRANSPORT_try_disconnect_cancel (struct GNUNET_TRANSPORT_TryDisconnectHandle *tdh) | ||
1595 | { | ||
1596 | struct GNUNET_TRANSPORT_Handle *th; | ||
1597 | |||
1598 | th = tdh->th; | ||
1599 | if (NULL != tdh->tth) | ||
1600 | cancel_control_transmit (th, tdh->tth); | ||
1601 | GNUNET_CONTAINER_DLL_remove (th->td_head, | ||
1602 | th->td_tail, | ||
1603 | tdh); | ||
1604 | GNUNET_free (tdh); | ||
1605 | } | ||
1606 | |||
1607 | |||
1608 | /** | ||
1609 | * Send HELLO message to the service. | 1451 | * Send HELLO message to the service. |
1610 | * | 1452 | * |
1611 | * @param cls the HELLO message to send | 1453 | * @param cls the HELLO message to send |