aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-11-29 20:47:18 +0000
committerChristian Grothoff <christian@grothoff.org>2011-11-29 20:47:18 +0000
commit71ea5bd2d05058008e604ffd42993be9c7250e04 (patch)
treea5074671ddfaa9d1621a4182fc95a91a98b3d536 /src/transport/gnunet-service-transport.c
parentb335777fd435142c16eb05e86c8a64a4b1a45447 (diff)
downloadgnunet-71ea5bd2d05058008e604ffd42993be9c7250e04.tar.gz
gnunet-71ea5bd2d05058008e604ffd42993be9c7250e04.zip
-fixing indentation
Diffstat (limited to 'src/transport/gnunet-service-transport.c')
-rw-r--r--src/transport/gnunet-service-transport.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index b148f289b..d4d8828d0 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -90,7 +90,7 @@ static void
90transmit_our_hello (void *cls, const struct GNUNET_PeerIdentity *target, 90transmit_our_hello (void *cls, const struct GNUNET_PeerIdentity *target,
91 const struct GNUNET_ATS_Information *ats, 91 const struct GNUNET_ATS_Information *ats,
92 uint32_t ats_count, 92 uint32_t ats_count,
93 const struct GNUNET_HELLO_Address *address) 93 const struct GNUNET_HELLO_Address *address)
94{ 94{
95 const struct GNUNET_MessageHeader *hello = cls; 95 const struct GNUNET_MessageHeader *hello = cls;
96 96
@@ -136,7 +136,7 @@ process_payload (const struct GNUNET_PeerIdentity *peer,
136 size_t msg_size = ntohs (message->size); 136 size_t msg_size = ntohs (message->size);
137 size_t size = 137 size_t size =
138 sizeof (struct InboundMessage) + msg_size + 138 sizeof (struct InboundMessage) + msg_size +
139 sizeof (struct GNUNET_ATS_Information) * (ats_count + 1); 139 sizeof (struct GNUNET_ATS_Information) * (ats_count + 1);
140 char buf[size]; 140 char buf[size];
141 struct GNUNET_ATS_Information *ap; 141 struct GNUNET_ATS_Information *ap;
142 142
@@ -168,10 +168,11 @@ process_payload (const struct GNUNET_PeerIdentity *peer,
168 ap = (struct GNUNET_ATS_Information *) &im[1]; 168 ap = (struct GNUNET_ATS_Information *) &im[1];
169 memcpy (ap, ats, ats_count * sizeof (struct GNUNET_ATS_Information)); 169 memcpy (ap, ats, ats_count * sizeof (struct GNUNET_ATS_Information));
170 ap[ats_count].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY); 170 ap[ats_count].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
171 ap[ats_count].value = htonl ((uint32_t) GST_neighbour_get_latency (peer).rel_value); 171 ap[ats_count].value =
172 htonl ((uint32_t) GST_neighbour_get_latency (peer).rel_value);
172 memcpy (&ap[ats_count + 1], message, ntohs (message->size)); 173 memcpy (&ap[ats_count + 1], message, ntohs (message->size));
173 174
174 GNUNET_ATS_address_update (GST_ats, address, session, ap, ats_count +1 ); 175 GNUNET_ATS_address_update (GST_ats, address, session, ap, ats_count + 1);
175 GST_clients_broadcast (&im->header, GNUNET_YES); 176 GST_clients_broadcast (&im->header, GNUNET_YES);
176 177
177 return ret; 178 return ret;
@@ -202,8 +203,7 @@ process_payload (const struct GNUNET_PeerIdentity *peer,
202 * (plugins that do not support this, can ignore the return value) 203 * (plugins that do not support this, can ignore the return value)
203 */ 204 */
204static struct GNUNET_TIME_Relative 205static struct GNUNET_TIME_Relative
205plugin_env_receive_callback (void *cls, 206plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
206 const struct GNUNET_PeerIdentity *peer,
207 const struct GNUNET_MessageHeader *message, 207 const struct GNUNET_MessageHeader *message,
208 const struct GNUNET_ATS_Information *ats, 208 const struct GNUNET_ATS_Information *ats,
209 uint32_t ats_count, struct Session *session, 209 uint32_t ats_count, struct Session *session,
@@ -237,8 +237,8 @@ plugin_env_receive_callback (void *cls,
237#if DEBUG_TRANSPORT 237#if DEBUG_TRANSPORT
238 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, 238 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
239 "Processing `%s' from `%s'\n", "PING", 239 "Processing `%s' from `%s'\n", "PING",
240 (sender_address != NULL) ? GST_plugins_a2s (&address) 240 (sender_address !=
241 : "<inbound>"); 241 NULL) ? GST_plugins_a2s (&address) : "<inbound>");
242#endif 242#endif
243 GST_validation_handle_ping (peer, message, &address, session); 243 GST_validation_handle_ping (peer, message, &address, session);
244 break; 244 break;
@@ -246,20 +246,22 @@ plugin_env_receive_callback (void *cls,
246#if DEBUG_TRANSPORT 246#if DEBUG_TRANSPORT
247 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, 247 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
248 "Processing `%s' from `%s'\n", "PONG", 248 "Processing `%s' from `%s'\n", "PONG",
249 (sender_address != NULL) ? GST_plugins_a2s (&address) 249 (sender_address !=
250 : "<inbound>"); 250 NULL) ? GST_plugins_a2s (&address) : "<inbound>");
251#endif 251#endif
252 GST_validation_handle_pong (peer, message); 252 GST_validation_handle_pong (peer, message);
253 break; 253 break;
254 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT: 254 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT:
255 GST_neighbours_handle_connect (message, peer, &address, session, ats, ats_count); 255 GST_neighbours_handle_connect (message, peer, &address, session, ats,
256 ats_count);
256 break; 257 break;
257 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT_ACK: 258 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT_ACK:
258 GST_neighbours_handle_connect_ack (message, peer, &address, 259 GST_neighbours_handle_connect_ack (message, peer, &address, session, ats,
259 session, ats, ats_count); 260 ats_count);
260 break; 261 break;
261 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_ACK: 262 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_ACK:
262 GST_neighbours_handle_ack (message, peer, &address, session, ats, ats_count); 263 GST_neighbours_handle_ack (message, peer, &address, session, ats,
264 ats_count);
263 break; 265 break;
264 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT: 266 case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT:
265 GST_neighbours_handle_disconnect_message (peer, message); 267 GST_neighbours_handle_disconnect_message (peer, message);
@@ -336,7 +338,7 @@ plugin_env_session_end (void *cls, const struct GNUNET_PeerIdentity *peer,
336 const char *transport_name = cls; 338 const char *transport_name = cls;
337 struct GNUNET_HELLO_Address address; 339 struct GNUNET_HELLO_Address address;
338 340
339 GNUNET_assert (strlen(transport_name) > 0); 341 GNUNET_assert (strlen (transport_name) > 0);
340#if DEBUG_TRANSPORT 342#if DEBUG_TRANSPORT
341 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Session %X to peer `%s' ended \n", 343 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Session %X to peer `%s' ended \n",
342 session, GNUNET_i2s (peer)); 344 session, GNUNET_i2s (peer));
@@ -369,8 +371,8 @@ plugin_env_session_end (void *cls, const struct GNUNET_PeerIdentity *peer,
369 * @param bandwidth_in assigned inbound bandwidth for the connection, 0 to disconnect from peer 371 * @param bandwidth_in assigned inbound bandwidth for the connection, 0 to disconnect from peer
370 */ 372 */
371static void 373static void
372ats_request_address_change (void *cls, 374ats_request_address_change (void *cls,
373 const struct GNUNET_HELLO_Address *address, 375 const struct GNUNET_HELLO_Address *address,
374 struct Session *session, 376 struct Session *session,
375 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 377 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
376 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 378 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
@@ -392,8 +394,7 @@ ats_request_address_change (void *cls,
392 return; 394 return;
393 } 395 }
394 /* will never return GNUNET_YES since connection is to be established */ 396 /* will never return GNUNET_YES since connection is to be established */
395 GST_neighbours_switch_to_address_3way (&address->peer, 397 GST_neighbours_switch_to_address_3way (&address->peer, address, session, ats,
396 address, session, ats,
397 ats_count, bandwidth_in, 398 ats_count, bandwidth_in,
398 bandwidth_out); 399 bandwidth_out);
399} 400}