diff options
author | Bart Polot <bart@net.in.tum.de> | 2011-10-15 10:08:05 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2011-10-15 10:08:05 +0000 |
commit | b712700e740862c9ea773a5eb95eec9924a9b57e (patch) | |
tree | 1a8036c68d659c132cc9fc7eab760605964a1bac /src/mesh | |
parent | 14c1597bdc566612ac267c278b71fefec97fcbde (diff) | |
download | gnunet-b712700e740862c9ea773a5eb95eec9924a9b57e.tar.gz gnunet-b712700e740862c9ea773a5eb95eec9924a9b57e.zip |
Fixed bug with cancellation of pendint transmisions on peer disconnect, added timeout for pending multicast data.
Diffstat (limited to 'src/mesh')
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 7a49c3be8..45d5d2cfd 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -320,7 +320,7 @@ struct MeshPathInfo | |||
320 | struct MeshTunnel *t; | 320 | struct MeshTunnel *t; |
321 | 321 | ||
322 | /** | 322 | /** |
323 | * Destination peer | 323 | * Neighbouring peer to whom we send the packet to |
324 | */ | 324 | */ |
325 | struct MeshPeerInfo *peer; | 325 | struct MeshPeerInfo *peer; |
326 | 326 | ||
@@ -827,11 +827,20 @@ peer_info_cancel_transmission(struct MeshPeerInfo *peer, unsigned int i) | |||
827 | struct MeshDataDescriptor *dd; | 827 | struct MeshDataDescriptor *dd; |
828 | struct MeshPathInfo *path_info; | 828 | struct MeshPathInfo *path_info; |
829 | 829 | ||
830 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 830 | #if MESH_DEBUG |
831 | "MESH: Cancelling data transmission at %u\n", | 831 | { |
832 | i); | 832 | struct GNUNET_PeerIdentity id; |
833 | GNUNET_CORE_notify_transmit_ready_cancel (peer->core_transmit[i]); | 833 | |
834 | peer->core_transmit[i] = NULL; | 834 | GNUNET_PEER_resolve (peer->id, &id); |
835 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
836 | "MESH: Cancelling data transmission at %s [%u]\n", | ||
837 | GNUNET_i2s (&id), | ||
838 | i); | ||
839 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
840 | "MESH: message type %u\n", | ||
841 | peer->types[i]); | ||
842 | } | ||
843 | #endif | ||
835 | /* TODO: notify that tranmission has failed */ | 844 | /* TODO: notify that tranmission has failed */ |
836 | switch (peer->types[i]) | 845 | switch (peer->types[i]) |
837 | { | 846 | { |
@@ -851,7 +860,12 @@ peer_info_cancel_transmission(struct MeshPeerInfo *peer, unsigned int i) | |||
851 | path_info = peer->infos[i]; | 860 | path_info = peer->infos[i]; |
852 | path_destroy(path_info->path); | 861 | path_destroy(path_info->path); |
853 | break; | 862 | break; |
863 | default: | ||
864 | GNUNET_break (0); | ||
865 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: type unknown!\n"); | ||
854 | } | 866 | } |
867 | GNUNET_CORE_notify_transmit_ready_cancel (peer->core_transmit[i]); | ||
868 | peer->core_transmit[i] = NULL; | ||
855 | GNUNET_free (peer->infos[i]); | 869 | GNUNET_free (peer->infos[i]); |
856 | } | 870 | } |
857 | } | 871 | } |
@@ -999,9 +1013,9 @@ send_create_path (struct MeshPeerInfo *peer, | |||
999 | 1013 | ||
1000 | path_info = GNUNET_malloc (sizeof (struct MeshPathInfo)); | 1014 | path_info = GNUNET_malloc (sizeof (struct MeshPathInfo)); |
1001 | path_info->path = p; | 1015 | path_info->path = p; |
1002 | path_info->peer = peer; | ||
1003 | path_info->t = t; | 1016 | path_info->t = t; |
1004 | neighbor = peer_info_get(&id); | 1017 | neighbor = peer_info_get(&id); |
1018 | path_info->peer = neighbor; | ||
1005 | path_info->pos = peer_info_transmit_slot(neighbor); | 1019 | path_info->pos = peer_info_transmit_slot(neighbor); |
1006 | neighbor->types[path_info->pos] = GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE; | 1020 | neighbor->types[path_info->pos] = GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE; |
1007 | neighbor->infos[path_info->pos] = path_info; | 1021 | neighbor->infos[path_info->pos] = path_info; |
@@ -1715,6 +1729,8 @@ send_core_create_path (void *cls, size_t size, void *buf) | |||
1715 | size_t size_needed; | 1729 | size_t size_needed; |
1716 | int i; | 1730 | int i; |
1717 | 1731 | ||
1732 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1733 | "MESH: CREATE PATH sending...\n"); | ||
1718 | size_needed = | 1734 | size_needed = |
1719 | sizeof (struct GNUNET_MESH_ManipulatePath) + | 1735 | sizeof (struct GNUNET_MESH_ManipulatePath) + |
1720 | p->length * sizeof (struct GNUNET_PeerIdentity); | 1736 | p->length * sizeof (struct GNUNET_PeerIdentity); |
@@ -1735,7 +1751,17 @@ send_core_create_path (void *cls, size_t size, void *buf) | |||
1735 | return 0; | 1751 | return 0; |
1736 | } | 1752 | } |
1737 | info->peer->core_transmit[info->pos] = NULL; | 1753 | info->peer->core_transmit[info->pos] = NULL; |
1754 | #if MESH_DEBUG | ||
1755 | { | ||
1756 | struct GNUNET_PeerIdentity id; | ||
1738 | 1757 | ||
1758 | GNUNET_PEER_resolve (peer->id, &id); | ||
1759 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1760 | "MESH: setting core_transmit %s [%u] to NULL\n", | ||
1761 | GNUNET_i2s (&id), | ||
1762 | info->pos); | ||
1763 | } | ||
1764 | #endif | ||
1739 | msg = (struct GNUNET_MESH_ManipulatePath *) buf; | 1765 | msg = (struct GNUNET_MESH_ManipulatePath *) buf; |
1740 | msg->header.size = htons (size_needed); | 1766 | msg->header.size = htons (size_needed); |
1741 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE); | 1767 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE); |
@@ -1858,11 +1884,8 @@ send_core_data_multicast (void *cls, size_t size, void *buf) | |||
1858 | { | 1884 | { |
1859 | if (NULL != info->client) | 1885 | if (NULL != info->client) |
1860 | { | 1886 | { |
1861 | /* FIXME One unresponsive neighbor (who doesn't "call" tmt_rdy) can lock | 1887 | if (GNUNET_SCHEDULER_NO_TASK != info->timeout_task) |
1862 | * the client from sending anything else to the service. | 1888 | GNUNET_SCHEDULER_cancel(info->timeout_task); |
1863 | * - Call receive_done after certain timeout. | ||
1864 | * - Here cancel the timeout. | ||
1865 | */ | ||
1866 | GNUNET_SERVER_receive_done (info->client, GNUNET_OK); | 1889 | GNUNET_SERVER_receive_done (info->client, GNUNET_OK); |
1867 | } | 1890 | } |
1868 | GNUNET_free (info->data); | 1891 | GNUNET_free (info->data); |
@@ -2591,11 +2614,11 @@ path_refresh (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2591 | struct GNUNET_MESH_Multicast *msg; | 2614 | struct GNUNET_MESH_Multicast *msg; |
2592 | size_t size; | 2615 | size_t size; |
2593 | 2616 | ||
2594 | t->path_refresh_task = GNUNET_SCHEDULER_NO_TASK; | ||
2595 | if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) | 2617 | if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) |
2596 | { | 2618 | { |
2597 | return; | 2619 | return; |
2598 | } | 2620 | } |
2621 | t->path_refresh_task = GNUNET_SCHEDULER_NO_TASK; | ||
2599 | 2622 | ||
2600 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2623 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2601 | "MESH: sending keepalive for tunnel %d\n", | 2624 | "MESH: sending keepalive for tunnel %d\n", |