aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/mesh_api.c
diff options
context:
space:
mode:
authorPhilipp Tölke <toelke@in.tum.de>2011-01-10 21:41:44 +0000
committerPhilipp Tölke <toelke@in.tum.de>2011-01-10 21:41:44 +0000
commit02530f44ebadfe7c7758cdbad94d7fcddf28827f (patch)
tree285d5a38a57291b31846f1bb53045e311ec4b129 /src/mesh/mesh_api.c
parent85aebf0bc477953b80f62bd26cd528a8932501a4 (diff)
downloadgnunet-02530f44ebadfe7c7758cdbad94d7fcddf28827f.tar.gz
gnunet-02530f44ebadfe7c7758cdbad94d7fcddf28827f.zip
changes to the mesh-api
Diffstat (limited to 'src/mesh/mesh_api.c')
-rw-r--r--src/mesh/mesh_api.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c
index 32996e0db..f1f9b17ab 100644
--- a/src/mesh/mesh_api.c
+++ b/src/mesh/mesh_api.c
@@ -104,6 +104,25 @@ struct GNUNET_MESH_Handle
104}; 104};
105 105
106static void 106static void
107send_end_connect(void* cls,
108 const struct GNUNET_SCHEDULER_TaskContext* tc)
109{
110 struct GNUNET_MESH_Tunnel* tunnel = cls;
111
112 tunnel->connect_handler(tunnel->handler_cls, NULL, NULL);
113}
114
115static void
116send_self_connect(void* cls,
117 const struct GNUNET_SCHEDULER_TaskContext* tc)
118{
119 struct GNUNET_MESH_Tunnel* tunnel = cls;
120
121 tunnel->connect_handler(tunnel->handler_cls, &tunnel->handle->myself, NULL);
122 GNUNET_SCHEDULER_add_now(send_end_connect, tunnel);
123}
124
125static void
107core_startup (void *cls, 126core_startup (void *cls,
108 struct GNUNET_CORE_Handle *core, 127 struct GNUNET_CORE_Handle *core,
109 const struct GNUNET_PeerIdentity *my_identity, 128 const struct GNUNET_PeerIdentity *my_identity,
@@ -160,6 +179,7 @@ core_connect (void *cls,
160 tunnel); 179 tunnel);
161 tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls, 180 tunnel->tunnel.connect_handler (tunnel->tunnel.handler_cls,
162 peer, atsi); 181 peer, atsi);
182 GNUNET_SCHEDULER_add_now(send_end_connect, tunnel);
163 tunnel = next; 183 tunnel = next;
164 } 184 }
165 else 185 else
@@ -349,7 +369,7 @@ GNUNET_MESH_peer_request_connect_all (struct GNUNET_MESH_Handle *handle,
349 handle->established_tunnels.tail, 369 handle->established_tunnels.tail,
350 handle->established_tunnels.tail, 370 handle->established_tunnels.tail,
351 tunnel); 371 tunnel);
352 connect_handler (handler_cls, &handle->myself, NULL); 372 GNUNET_SCHEDULER_add_now(send_self_connect, tunnel);
353 } 373 }
354 else 374 else
355 { 375 {
@@ -363,6 +383,12 @@ GNUNET_MESH_peer_request_connect_all (struct GNUNET_MESH_Handle *handle,
363 return &tunnel->tunnel; 383 return &tunnel->tunnel;
364} 384}
365 385
386const struct GNUNET_PeerIdentity*
387GNUNET_MESH_get_peer(const struct GNUNET_MESH_Tunnel* tunnel)
388{
389 return &tunnel->peer;
390}
391
366static size_t 392static size_t
367core_notify(void* cls, size_t size, void* buf) 393core_notify(void* cls, size_t size, void* buf)
368{ 394{