diff options
Diffstat (limited to 'src/mesh/gnunet-service-mesh_connection.c')
-rw-r--r-- | src/mesh/gnunet-service-mesh_connection.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index ee19d6706..7e2f61569 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c | |||
@@ -2065,4 +2065,52 @@ GMC_send_destroy (struct MeshConnection *c) | |||
2065 | if (GNUNET_NO == GMC_is_terminal (c, GNUNET_NO)) | 2065 | if (GNUNET_NO == GMC_is_terminal (c, GNUNET_NO)) |
2066 | GMC_send_prebuilt_message (&msg.header, c, NULL, GNUNET_NO); | 2066 | GMC_send_prebuilt_message (&msg.header, c, NULL, GNUNET_NO); |
2067 | c->destroy = GNUNET_YES; | 2067 | c->destroy = GNUNET_YES; |
2068 | } | ||
2069 | |||
2070 | |||
2071 | /** | ||
2072 | * @brief Start a polling timer for the connection. | ||
2073 | * | ||
2074 | * When a neighbor does not accept more traffic on the connection it could be | ||
2075 | * caused by a simple congestion or by a lost ACK. Polling enables to check | ||
2076 | * for the lastest ACK status for a connection. | ||
2077 | * | ||
2078 | * @param c Connection. | ||
2079 | * @param fwd Should we poll in the FWD direction? | ||
2080 | */ | ||
2081 | void | ||
2082 | GMC_start_poll (struct MeshConnection *c, int fwd) | ||
2083 | { | ||
2084 | struct MeshFlowControl *fc; | ||
2085 | |||
2086 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | ||
2087 | if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task) | ||
2088 | { | ||
2089 | return; | ||
2090 | } | ||
2091 | fc->poll_task = GNUNET_SCHEDULER_add_delayed (fc->poll_time, | ||
2092 | &connection_poll, | ||
2093 | fc); | ||
2094 | } | ||
2095 | |||
2096 | |||
2097 | /** | ||
2098 | * @brief Stop polling a connection for ACKs. | ||
2099 | * | ||
2100 | * Once we have enough ACKs for future traffic, polls are no longer necessary. | ||
2101 | * | ||
2102 | * @param c Connection. | ||
2103 | * @param fwd Should we stop the poll in the FWD direction? | ||
2104 | */ | ||
2105 | void | ||
2106 | GMC_stop_poll (struct MeshConnection *c, int fwd) | ||
2107 | { | ||
2108 | struct MeshFlowControl *fc; | ||
2109 | |||
2110 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | ||
2111 | if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task) | ||
2112 | { | ||
2113 | GNUNET_SCHEDULER_cancel (fc->poll_task); | ||
2114 | fc->poll_task = GNUNET_SCHEDULER_NO_TASK; | ||
2115 | } | ||
2068 | } \ No newline at end of file | 2116 | } \ No newline at end of file |