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 | |
parent | 44cb69974fb8fa57c4e367af070a6d7bfcda8d7d (diff) | |
download | gnunet-75e1efb22d791bd28be6acbc19dbcdfbd737c173.tar.gz gnunet-75e1efb22d791bd28be6acbc19dbcdfbd737c173.zip |
-remove deprecated try_disconnect API
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_protocols.h | 6 | ||||
-rw-r--r-- | src/include/gnunet_transport_service.h | 46 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_clients.c | 39 | ||||
-rw-r--r-- | src/transport/transport_api.c | 158 |
4 files changed, 0 insertions, 249 deletions
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index a47af7f59..9ac749637 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -1364,12 +1364,6 @@ extern "C" | |||
1364 | */ | 1364 | */ |
1365 | #define GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_SYNC 390 | 1365 | #define GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_SYNC 390 |
1366 | 1366 | ||
1367 | /** | ||
1368 | * Message for transport service from a client asking that a | ||
1369 | * connection with another peer be torn down. | ||
1370 | */ | ||
1371 | #define GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_DISCONNECT 391 | ||
1372 | |||
1373 | 1367 | ||
1374 | /******************************************************************************* | 1368 | /******************************************************************************* |
1375 | * FS-PUBLISH-HELPER IPC Messages | 1369 | * FS-PUBLISH-HELPER IPC Messages |
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index 5acc2807c..c2f5798ad 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h | |||
@@ -209,52 +209,6 @@ void | |||
209 | GNUNET_TRANSPORT_try_connect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle *tch); | 209 | GNUNET_TRANSPORT_try_connect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle *tch); |
210 | 210 | ||
211 | 211 | ||
212 | /** | ||
213 | * Opaque handle for a transmission-ready request. | ||
214 | */ | ||
215 | struct GNUNET_TRANSPORT_TryDisconnectHandle; | ||
216 | |||
217 | /** | ||
218 | * Function to call with result of the try connect request. | ||
219 | * | ||
220 | * @param cls closure | ||
221 | * @param result #GNUNET_OK if message was transmitted to transport service | ||
222 | * #GNUNET_SYSERR if message was not transmitted to transport service | ||
223 | */ | ||
224 | typedef void | ||
225 | (*GNUNET_TRANSPORT_TryDisconnectCallback) (void *cls, | ||
226 | int result); | ||
227 | |||
228 | |||
229 | /** | ||
230 | * Ask the transport service to disconnect from the given peer. | ||
231 | * | ||
232 | * @param handle connection to transport service | ||
233 | * @param target who we should try to disconnect from | ||
234 | * @param cb callback to be called when request was transmitted to transport | ||
235 | * service | ||
236 | * @param cb_cls closure for the callback @a cb | ||
237 | * @return a `struct GNUNET_TRANSPORT_TryConnectHandle` handle or | ||
238 | * NULL on failure (@a cb will not be called) | ||
239 | * @deprecated use blacklisting API instead! | ||
240 | */ | ||
241 | struct GNUNET_TRANSPORT_TryDisconnectHandle * | ||
242 | GNUNET_TRANSPORT_try_disconnect (struct GNUNET_TRANSPORT_Handle *handle, | ||
243 | const struct GNUNET_PeerIdentity *target, | ||
244 | GNUNET_TRANSPORT_TryDisconnectCallback cb, | ||
245 | void *cb_cls); | ||
246 | |||
247 | |||
248 | /** | ||
249 | * Cancel the request to transport to disconnect. | ||
250 | * Callback will not be called anymore. | ||
251 | * | ||
252 | * @param tdh handle for operation to cancel | ||
253 | */ | ||
254 | void | ||
255 | GNUNET_TRANSPORT_try_disconnect_cancel (struct GNUNET_TRANSPORT_TryDisconnectHandle *tdh); | ||
256 | |||
257 | |||
258 | /* ************************* Sending *************************** */ | 212 | /* ************************* Sending *************************** */ |
259 | 213 | ||
260 | /** | 214 | /** |
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index 8c1ca61e5..538dd15ea 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c | |||
@@ -879,42 +879,6 @@ clients_handle_request_connect (void *cls, | |||
879 | 879 | ||
880 | 880 | ||
881 | /** | 881 | /** |
882 | * Handle request disconnect message | ||
883 | * | ||
884 | * @param cls closure (always NULL) | ||
885 | * @param client identification of the client | ||
886 | * @param message the actual message | ||
887 | */ | ||
888 | static void | ||
889 | clients_handle_request_disconnect (void *cls, | ||
890 | struct GNUNET_SERVER_Client *client, | ||
891 | const struct GNUNET_MessageHeader *message) | ||
892 | { | ||
893 | const struct TransportRequestDisconnectMessage *trdm; | ||
894 | |||
895 | trdm = (const struct TransportRequestDisconnectMessage *) message; | ||
896 | GNUNET_break (0 == ntohl (trdm->reserved)); | ||
897 | GNUNET_STATISTICS_update (GST_stats, | ||
898 | gettext_noop | ||
899 | ("# REQUEST DISCONNECT messages received"), 1, | ||
900 | GNUNET_NO); | ||
901 | if (0 == memcmp (&trdm->peer, | ||
902 | &GST_my_identity, | ||
903 | sizeof (struct GNUNET_PeerIdentity))) | ||
904 | { | ||
905 | GNUNET_break (0); | ||
906 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | ||
907 | return; | ||
908 | } | ||
909 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
910 | "Received a request disconnect message for peer `%s'\n", | ||
911 | GNUNET_i2s (&trdm->peer)); | ||
912 | (void) GST_neighbours_force_disconnect (&trdm->peer); | ||
913 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | ||
914 | } | ||
915 | |||
916 | |||
917 | /** | ||
918 | * Take the given address and append it to the set of results sent back to | 882 | * Take the given address and append it to the set of results sent back to |
919 | * the client. This function may be called serveral times for a single | 883 | * the client. This function may be called serveral times for a single |
920 | * conversion. The last invocation will be with a @a address of | 884 | * conversion. The last invocation will be with a @a address of |
@@ -1551,9 +1515,6 @@ GST_clients_start (struct GNUNET_SERVER_Handle *server) | |||
1551 | {&clients_handle_request_connect, NULL, | 1515 | {&clients_handle_request_connect, NULL, |
1552 | GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_CONNECT, | 1516 | GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_CONNECT, |
1553 | sizeof (struct TransportRequestConnectMessage)}, | 1517 | sizeof (struct TransportRequestConnectMessage)}, |
1554 | {&clients_handle_request_disconnect, NULL, | ||
1555 | GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_DISCONNECT, | ||
1556 | sizeof (struct TransportRequestDisconnectMessage)}, | ||
1557 | {&clients_handle_address_to_string, NULL, | 1518 | {&clients_handle_address_to_string, NULL, |
1558 | GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING, 0}, | 1519 | GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING, 0}, |
1559 | {&clients_handle_monitor_peers, NULL, | 1520 | {&clients_handle_monitor_peers, NULL, |
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 |