aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2014-03-07 15:47:41 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2014-03-07 15:47:41 +0000
commitacc0419893e4cb67e46357fe77f0e8a285c6ee31 (patch)
treef5651fb5656c4741db397dbeb3639cdf6dd57876 /src/testbed
parentcbeb17e103ce6bac1f0b6068e65dd048041903fb (diff)
downloadgnunet-acc0419893e4cb67e46357fe77f0e8a285c6ee31.tar.gz
gnunet-acc0419893e4cb67e46357fe77f0e8a285c6ee31.zip
- remove dead code
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/gnunet-service-testbed-logger.c77
1 files changed, 0 insertions, 77 deletions
diff --git a/src/testbed/gnunet-service-testbed-logger.c b/src/testbed/gnunet-service-testbed-logger.c
index 8129c7cbf..deaeca543 100644
--- a/src/testbed/gnunet-service-testbed-logger.c
+++ b/src/testbed/gnunet-service-testbed-logger.c
@@ -66,11 +66,6 @@ struct MessageQueue
66}; 66};
67 67
68/** 68/**
69 * Current Transmit Handle; NULL if no notify transmit exists currently
70 */
71static struct GNUNET_SERVER_TransmitHandle *transmit_handle;
72
73/**
74 * The message queue head 69 * The message queue head
75 */ 70 */
76static struct MessageQueue *mq_head; 71static struct MessageQueue *mq_head;
@@ -90,76 +85,6 @@ struct GNUNET_BIO_WriteHandle *bio;
90 */ 85 */
91static GNUNET_SCHEDULER_TaskIdentifier shutdown_task_id; 86static GNUNET_SCHEDULER_TaskIdentifier shutdown_task_id;
92 87
93
94/**
95 * Function called to notify a client about the connection begin ready to queue
96 * more data. "buf" will be NULL and "size" zero if the connection was closed
97 * for writing in the meantime.
98 *
99 * @param cls NULL
100 * @param size number of bytes available in buf
101 * @param buf where the callee should write the message
102 * @return number of bytes written to buf
103 */
104static size_t
105transmit_ready_notify (void *cls, size_t size, void *buf)
106{
107 struct MessageQueue *mq_entry;
108
109 transmit_handle = NULL;
110 mq_entry = mq_head;
111 GNUNET_assert (NULL != mq_entry);
112 if (0 == size)
113 return 0;
114 GNUNET_assert (ntohs (mq_entry->msg->size) <= size);
115 size = ntohs (mq_entry->msg->size);
116 memcpy (buf, mq_entry->msg, size);
117 GNUNET_free (mq_entry->msg);
118 GNUNET_SERVER_client_drop (mq_entry->client);
119 GNUNET_CONTAINER_DLL_remove (mq_head, mq_tail, mq_entry);
120 GNUNET_free (mq_entry);
121 mq_entry = mq_head;
122 if (NULL != mq_entry)
123 transmit_handle =
124 GNUNET_SERVER_notify_transmit_ready (mq_entry->client,
125 ntohs (mq_entry->msg->size),
126 GNUNET_TIME_UNIT_FOREVER_REL,
127 &transmit_ready_notify, NULL);
128 return size;
129}
130
131
132/**
133 * Queues a message in send queue for sending to the service
134 *
135 * @param client the client to whom the queued message has to be sent
136 * @param msg the message to queue
137 */
138void
139queue_message (struct GNUNET_SERVER_Client *client,
140 struct GNUNET_MessageHeader *msg)
141{
142 struct MessageQueue *mq_entry;
143 uint16_t type;
144 uint16_t size;
145
146 type = ntohs (msg->type);
147 size = ntohs (msg->size);
148 mq_entry = GNUNET_new (struct MessageQueue);
149 mq_entry->msg = msg;
150 mq_entry->client = client;
151 GNUNET_SERVER_client_keep (client);
152 LOG_DEBUG ("Queueing message of type %u, size %u for sending\n", type,
153 ntohs (msg->size));
154 GNUNET_CONTAINER_DLL_insert_tail (mq_head, mq_tail, mq_entry);
155 if (NULL == transmit_handle)
156 transmit_handle =
157 GNUNET_SERVER_notify_transmit_ready (client, size,
158 GNUNET_TIME_UNIT_FOREVER_REL,
159 &transmit_ready_notify, NULL);
160}
161
162
163/** 88/**
164 * Message handler for GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST messages 89 * Message handler for GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST messages
165 * 90 *
@@ -192,8 +117,6 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
192 struct MessageQueue *mq_entry; 117 struct MessageQueue *mq_entry;
193 118
194 shutdown_task_id = GNUNET_SCHEDULER_NO_TASK; 119 shutdown_task_id = GNUNET_SCHEDULER_NO_TASK;
195 if (NULL != transmit_handle)
196 GNUNET_SERVER_notify_transmit_ready_cancel (transmit_handle);
197 while (NULL != (mq_entry = mq_head)) 120 while (NULL != (mq_entry = mq_head))
198 { 121 {
199 GNUNET_free (mq_entry->msg); 122 GNUNET_free (mq_entry->msg);