From: Christian Grothoff Date: Tue, 30 Aug 2011 13:03:41 +0000 (+0000) Subject: communicate operation timeouts X-Git-Tag: initial-import-from-subversion-38251~17282 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9588b24a6e0629d3b5849d9c291038539f128e7b;p=oweals%2Fgnunet.git communicate operation timeouts --- diff --git a/src/mesh/mesh.h b/src/mesh/mesh.h index b9f2226b9..4e5f6e802 100644 --- a/src/mesh/mesh.h +++ b/src/mesh/mesh.h @@ -145,6 +145,13 @@ struct GNUNET_MESH_PeerControl */ MESH_TunnelNumber tunnel_id GNUNET_PACKED; + /** + * When should this request time out (the service abort trying to find + * a matching peer)? The request should naturally also be aborted + * if the corresponding client disconnects. + */ + struct GNUNET_TIME_AbsoluteNBO timeout; + /** * Peer to connect/disconnect. */ @@ -167,6 +174,13 @@ struct GNUNET_MESH_ConnectPeerByType */ MESH_TunnelNumber tunnel_id GNUNET_PACKED; + /** + * When should this request time out (the service abort trying to find + * a matching peer)? The request should naturally also be aborted + * if the corresponding client disconnects. + */ + struct GNUNET_TIME_AbsoluteNBO timeout; + /** * Type specification */ diff --git a/src/mesh/mesh_api_new.c b/src/mesh/mesh_api_new.c index e4b407d32..79536238f 100644 --- a/src/mesh/mesh_api_new.c +++ b/src/mesh/mesh_api_new.c @@ -892,6 +892,7 @@ GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel, msg->header.size = htons (sizeof (struct GNUNET_MESH_PeerControl)); msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ADD); msg->tunnel_id = htonl (tunnel->tid); + msg->timeout = GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (timeout)); memcpy (&msg->peer, peer, sizeof (struct GNUNET_PeerIdentity)); send_packet (tunnel->mesh, &msg->header); @@ -939,6 +940,7 @@ GNUNET_MESH_peer_request_connect_del (struct GNUNET_MESH_Tunnel *tunnel, msg.header.size = htons (sizeof (struct GNUNET_MESH_PeerControl)); msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_DEL); msg.tunnel_id = htonl (tunnel->tid); + msg.timeout = GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_FOREVER_ABS); memcpy (&msg.peer, peer, sizeof (struct GNUNET_PeerIdentity)); send_packet (tunnel->mesh, &msg.header); } @@ -963,9 +965,9 @@ GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Tunnel *tunnel, msg.header.size = htons (sizeof (struct GNUNET_MESH_ConnectPeerByType)); msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_BY_TYPE); msg.tunnel_id = htonl (tunnel->tid); + msg.timeout = GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (timeout)); msg.type = htonl (app_type); send_packet (tunnel->mesh, &msg.header); - // TODO: remember timeout }