diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-09-21 10:56:28 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-09-21 10:56:28 +0000 |
commit | d4afc6e37a14fe3257263c377a243c1a22ed9ee5 (patch) | |
tree | ccfce6d4f92808372d3e7ebfe9f5372e9f21f50c /src/ats/gnunet-service-ats_connectivity.c | |
parent | 60d02b5b0899f454cb65408bd2ed4c453fa75a3d (diff) | |
download | gnunet-d4afc6e37a14fe3257263c377a243c1a22ed9ee5.tar.gz gnunet-d4afc6e37a14fe3257263c377a243c1a22ed9ee5.zip |
migrating more services to new service API
Diffstat (limited to 'src/ats/gnunet-service-ats_connectivity.c')
-rw-r--r-- | src/ats/gnunet-service-ats_connectivity.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/src/ats/gnunet-service-ats_connectivity.c b/src/ats/gnunet-service-ats_connectivity.c index 2cf434c70..c47ee03e6 100644 --- a/src/ats/gnunet-service-ats_connectivity.c +++ b/src/ats/gnunet-service-ats_connectivity.c | |||
@@ -40,7 +40,7 @@ struct ConnectionRequest | |||
40 | /** | 40 | /** |
41 | * Client that made the request. | 41 | * Client that made the request. |
42 | */ | 42 | */ |
43 | struct GNUNET_SERVER_Client *client; | 43 | struct GNUNET_SERVICE_Client *client; |
44 | 44 | ||
45 | /* TODO: allow client to express a 'strength' for this request */ | 45 | /* TODO: allow client to express a 'strength' for this request */ |
46 | }; | 46 | }; |
@@ -75,17 +75,13 @@ GAS_connectivity_has_peer (void *cls, | |||
75 | /** | 75 | /** |
76 | * Handle #GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS messages from clients. | 76 | * Handle #GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS messages from clients. |
77 | * | 77 | * |
78 | * @param cls unused, NULL | ||
79 | * @param client client that sent the request | 78 | * @param client client that sent the request |
80 | * @param message the request message | 79 | * @param message the request message |
81 | */ | 80 | */ |
82 | void | 81 | void |
83 | GAS_handle_request_address (void *cls, | 82 | GAS_handle_request_address (struct GNUNET_SERVICE_Client *client, |
84 | struct GNUNET_SERVER_Client *client, | 83 | const struct RequestAddressMessage *msg) |
85 | const struct GNUNET_MessageHeader *message) | ||
86 | { | 84 | { |
87 | const struct RequestAddressMessage *msg = | ||
88 | (const struct RequestAddressMessage *) message; | ||
89 | struct ConnectionRequest *cr; | 85 | struct ConnectionRequest *cr; |
90 | 86 | ||
91 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 87 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -99,7 +95,6 @@ GAS_handle_request_address (void *cls, | |||
99 | cr, | 95 | cr, |
100 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 96 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
101 | GAS_plugin_request_connect_start (&msg->peer); | 97 | GAS_plugin_request_connect_start (&msg->peer); |
102 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | ||
103 | } | 98 | } |
104 | 99 | ||
105 | 100 | ||
@@ -117,7 +112,7 @@ free_matching_requests (void *cls, | |||
117 | const struct GNUNET_PeerIdentity *pid, | 112 | const struct GNUNET_PeerIdentity *pid, |
118 | void *value) | 113 | void *value) |
119 | { | 114 | { |
120 | struct GNUNET_SERVER_Client *client = cls; | 115 | struct GNUNET_SERVICE_Client *client = cls; |
121 | struct ConnectionRequest *cr = value; | 116 | struct ConnectionRequest *cr = value; |
122 | 117 | ||
123 | if (cr->client == client) | 118 | if (cr->client == client) |
@@ -140,18 +135,13 @@ free_matching_requests (void *cls, | |||
140 | * Handle #GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL messages | 135 | * Handle #GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL messages |
141 | * from clients. | 136 | * from clients. |
142 | * | 137 | * |
143 | * @param cls unused, NULL | 138 | * @param client the client that sent the request |
144 | * @param client client that sent the request | 139 | * @param msg the request message |
145 | * @param message the request message | ||
146 | */ | 140 | */ |
147 | void | 141 | void |
148 | GAS_handle_request_address_cancel (void *cls, | 142 | GAS_handle_request_address_cancel (struct GNUNET_SERVICE_Client *client, |
149 | struct GNUNET_SERVER_Client *client, | 143 | const struct RequestAddressMessage *msg) |
150 | const struct GNUNET_MessageHeader *message) | ||
151 | { | 144 | { |
152 | const struct RequestAddressMessage *msg = | ||
153 | (const struct RequestAddressMessage *) message; | ||
154 | |||
155 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 145 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
156 | "Received GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL message for peer %s\n", | 146 | "Received GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL message for peer %s\n", |
157 | GNUNET_i2s (&msg->peer)); | 147 | GNUNET_i2s (&msg->peer)); |
@@ -160,7 +150,6 @@ GAS_handle_request_address_cancel (void *cls, | |||
160 | &msg->peer, | 150 | &msg->peer, |
161 | &free_matching_requests, | 151 | &free_matching_requests, |
162 | client); | 152 | client); |
163 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | ||
164 | } | 153 | } |
165 | 154 | ||
166 | 155 | ||
@@ -171,7 +160,7 @@ GAS_handle_request_address_cancel (void *cls, | |||
171 | * @param client handle of the (now dead) client | 160 | * @param client handle of the (now dead) client |
172 | */ | 161 | */ |
173 | void | 162 | void |
174 | GAS_connectivity_remove_client (struct GNUNET_SERVER_Client *client) | 163 | GAS_connectivity_remove_client (struct GNUNET_SERVICE_Client *client) |
175 | { | 164 | { |
176 | GNUNET_CONTAINER_multipeermap_iterate (connection_requests, | 165 | GNUNET_CONTAINER_multipeermap_iterate (connection_requests, |
177 | &free_matching_requests, | 166 | &free_matching_requests, |
@@ -185,7 +174,9 @@ GAS_connectivity_remove_client (struct GNUNET_SERVER_Client *client) | |||
185 | void | 174 | void |
186 | GAS_connectivity_init () | 175 | GAS_connectivity_init () |
187 | { | 176 | { |
188 | connection_requests = GNUNET_CONTAINER_multipeermap_create (32, GNUNET_NO); | 177 | connection_requests |
178 | = GNUNET_CONTAINER_multipeermap_create (32, | ||
179 | GNUNET_NO); | ||
189 | } | 180 | } |
190 | 181 | ||
191 | 182 | ||