aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport_api_cmd_send_simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/transport_api_cmd_send_simple.c')
-rw-r--r--src/transport/transport_api_cmd_send_simple.c44
1 files changed, 37 insertions, 7 deletions
diff --git a/src/transport/transport_api_cmd_send_simple.c b/src/transport/transport_api_cmd_send_simple.c
index 790139cce..8b37dbf90 100644
--- a/src/transport/transport_api_cmd_send_simple.c
+++ b/src/transport/transport_api_cmd_send_simple.c
@@ -31,6 +31,11 @@
31#include "transport-testing-cmds.h" 31#include "transport-testing-cmds.h"
32 32
33/** 33/**
34 * Generic logging shortcut
35 */
36#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
37
38/**
34 * Struct to hold information for callbacks. 39 * Struct to hold information for callbacks.
35 * 40 *
36 */ 41 */
@@ -74,6 +79,32 @@ send_simple_cleanup (void *cls)
74} 79}
75 80
76 81
82static int
83send_simple_cb (void *cls,
84 const struct GNUNET_ShortHashCode *key,
85 void *value)
86{
87 struct SendSimpleState *sss = cls;
88 struct GNUNET_MQ_Handle *mq = value;
89 struct GNUNET_MQ_Envelope *env;
90 struct GNUNET_TRANSPORT_TESTING_TestMessage *test;
91
92 LOG (GNUNET_ERROR_TYPE_DEBUG,
93 "Sending simple test message\n");
94
95 env = GNUNET_MQ_msg_extra (test,
96 1000 - sizeof(*test),
97 GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE);
98 test->num = htonl (sss->num);
99 memset (&test[1],
100 sss->num,
101 1000 - sizeof(*test));
102 GNUNET_MQ_send (mq,
103 env);
104 return GNUNET_OK;
105}
106
107
77/** 108/**
78 * The run method of this cmd will send a simple message to the connected peers. 109 * The run method of this cmd will send a simple message to the connected peers.
79 * 110 *
@@ -83,12 +114,9 @@ send_simple_run (void *cls,
83 struct GNUNET_TESTING_Interpreter *is) 114 struct GNUNET_TESTING_Interpreter *is)
84{ 115{
85 struct SendSimpleState *sss = cls; 116 struct SendSimpleState *sss = cls;
86 struct GNUNET_MQ_Envelope *env;
87 struct GNUNET_TRANSPORT_TESTING_TestMessage *test;
88 struct GNUNET_MQ_Handle *mq;
89 struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; 117 struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
90 const struct GNUNET_TESTING_Command *peer1_cmd; 118 const struct GNUNET_TESTING_Command *peer1_cmd;
91 struct GNUNET_ShortHashCode *key = GNUNET_new (struct GNUNET_ShortHashCode); 119 // struct GNUNET_ShortHashCode *key = GNUNET_new (struct GNUNET_ShortHashCode);
92 struct GNUNET_HashCode hc; 120 struct GNUNET_HashCode hc;
93 struct GNUNET_TESTING_NodeConnection *node_connections_head; 121 struct GNUNET_TESTING_NodeConnection *node_connections_head;
94 struct GNUNET_PeerIdentity *peer; 122 struct GNUNET_PeerIdentity *peer;
@@ -111,7 +139,9 @@ send_simple_run (void *cls,
111 node_connections_head = GNUNET_TESTING_get_connections (sss->num, 139 node_connections_head = GNUNET_TESTING_get_connections (sss->num,
112 sss->topology); 140 sss->topology);
113 141
114 for (int i = 0; i < 1; i++) 142 GNUNET_CONTAINER_multishortmap_iterate (connected_peers_map, send_simple_cb,
143 sss);
144 /*for (int i = 0; i < 1; i++)
115 { 145 {
116 for (pos_connection = node_connections_head; NULL != pos_connection; 146 for (pos_connection = node_connections_head; NULL != pos_connection;
117 pos_connection = pos_connection->next) 147 pos_connection = pos_connection->next)
@@ -136,9 +166,9 @@ send_simple_run (void *cls,
136 GNUNET_MQ_send (mq, 166 GNUNET_MQ_send (mq,
137 env); 167 env);
138 } 168 }
139 } 169 }*/
140 170
141 GNUNET_free (key); 171 // GNUNET_free (key);
142 172
143} 173}
144 174