diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-06-12 10:18:36 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-06-12 10:18:36 +0000 |
commit | 4d6ca05269d154deb9b64dca0482d6879f47ed30 (patch) | |
tree | 52e1041a4e67e77a1b9337815703e1cff2b9c4d6 /src/gns/gnunet-gns-helper-service-w32.c | |
parent | f12241a28dd9c0233316850c6082e2db25b155cc (diff) | |
download | gnunet-4d6ca05269d154deb9b64dca0482d6879f47ed30.tar.gz gnunet-4d6ca05269d154deb9b64dca0482d6879f47ed30.zip |
-remove unnecessary client pointer from struct and avoid the keep/drop calls that are not needed
Diffstat (limited to 'src/gns/gnunet-gns-helper-service-w32.c')
-rw-r--r-- | src/gns/gnunet-gns-helper-service-w32.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/gns/gnunet-gns-helper-service-w32.c b/src/gns/gnunet-gns-helper-service-w32.c index 44ae87b84..a15b3547c 100644 --- a/src/gns/gnunet-gns-helper-service-w32.c +++ b/src/gns/gnunet-gns-helper-service-w32.c | |||
@@ -109,11 +109,6 @@ struct TransmitCallbackContext | |||
109 | */ | 109 | */ |
110 | struct GNUNET_SERVER_TransmitHandle *th; | 110 | struct GNUNET_SERVER_TransmitHandle *th; |
111 | 111 | ||
112 | /** | ||
113 | * Client that we are transmitting to. | ||
114 | */ | ||
115 | struct GNUNET_SERVER_Client *client; | ||
116 | |||
117 | }; | 112 | }; |
118 | 113 | ||
119 | 114 | ||
@@ -133,6 +128,7 @@ static struct TransmitCallbackContext *tcc_tail; | |||
133 | */ | 128 | */ |
134 | static int cleaning_done; | 129 | static int cleaning_done; |
135 | 130 | ||
131 | |||
136 | /** | 132 | /** |
137 | * Function called to notify a client about the socket | 133 | * Function called to notify a client about the socket |
138 | * begin ready to queue more data. "buf" will be | 134 | * begin ready to queue more data. "buf" will be |
@@ -157,14 +153,12 @@ transmit_callback (void *cls, size_t size, void *buf) | |||
157 | { | 153 | { |
158 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 154 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
159 | _("Transmission to client failed!\n")); | 155 | _("Transmission to client failed!\n")); |
160 | GNUNET_SERVER_client_drop (tcc->client); | ||
161 | GNUNET_free (tcc->msg); | 156 | GNUNET_free (tcc->msg); |
162 | GNUNET_free (tcc); | 157 | GNUNET_free (tcc); |
163 | return 0; | 158 | return 0; |
164 | } | 159 | } |
165 | GNUNET_assert (size >= msize); | 160 | GNUNET_assert (size >= msize); |
166 | memcpy (buf, tcc->msg, msize); | 161 | memcpy (buf, tcc->msg, msize); |
167 | GNUNET_SERVER_client_drop (tcc->client); | ||
168 | GNUNET_free (tcc->msg); | 162 | GNUNET_free (tcc->msg); |
169 | GNUNET_free (tcc); | 163 | GNUNET_free (tcc); |
170 | return msize; | 164 | return msize; |
@@ -187,13 +181,11 @@ transmit (struct GNUNET_SERVER_Client *client, | |||
187 | { | 181 | { |
188 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 182 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
189 | _("Shutdown in progress, aborting transmission.\n")); | 183 | _("Shutdown in progress, aborting transmission.\n")); |
190 | GNUNET_SERVER_client_drop (client); | ||
191 | GNUNET_free (msg); | 184 | GNUNET_free (msg); |
192 | return; | 185 | return; |
193 | } | 186 | } |
194 | tcc = GNUNET_malloc (sizeof (struct TransmitCallbackContext)); | 187 | tcc = GNUNET_malloc (sizeof (struct TransmitCallbackContext)); |
195 | tcc->msg = msg; | 188 | tcc->msg = msg; |
196 | tcc->client = client; | ||
197 | if (NULL == | 189 | if (NULL == |
198 | (tcc->th = | 190 | (tcc->th = |
199 | GNUNET_SERVER_notify_transmit_ready (client, | 191 | GNUNET_SERVER_notify_transmit_ready (client, |
@@ -202,19 +194,19 @@ transmit (struct GNUNET_SERVER_Client *client, | |||
202 | &transmit_callback, tcc))) | 194 | &transmit_callback, tcc))) |
203 | { | 195 | { |
204 | GNUNET_break (0); | 196 | GNUNET_break (0); |
205 | GNUNET_SERVER_client_drop (client); | ||
206 | GNUNET_free (msg); | 197 | GNUNET_free (msg); |
207 | GNUNET_free (tcc); | 198 | GNUNET_free (tcc); |
208 | return; | 199 | return; |
209 | } | 200 | } |
210 | GNUNET_SERVER_client_keep (client); | ||
211 | GNUNET_CONTAINER_DLL_insert (tcc_head, tcc_tail, tcc); | 201 | GNUNET_CONTAINER_DLL_insert (tcc_head, tcc_tail, tcc); |
212 | } | 202 | } |
213 | 203 | ||
204 | |||
214 | #define MarshallPtr(ptr, base, type) \ | 205 | #define MarshallPtr(ptr, base, type) \ |
215 | if (ptr) \ | 206 | if (ptr) \ |
216 | ptr = (type *) ((char *) ptr - (char *) base) | 207 | ptr = (type *) ((char *) ptr - (char *) base) |
217 | 208 | ||
209 | |||
218 | void | 210 | void |
219 | MarshallWSAQUERYSETW (WSAQUERYSETW *qs, GUID *sc) | 211 | MarshallWSAQUERYSETW (WSAQUERYSETW *qs, GUID *sc) |
220 | { | 212 | { |
@@ -508,6 +500,7 @@ process_ip_lookup_result (void* cls, | |||
508 | transmit (rq->client, &msg->header); | 500 | transmit (rq->client, &msg->header); |
509 | } | 501 | } |
510 | 502 | ||
503 | |||
511 | static void | 504 | static void |
512 | get_ip_from_hostname (struct GNUNET_SERVER_Client *client, | 505 | get_ip_from_hostname (struct GNUNET_SERVER_Client *client, |
513 | const wchar_t *name, int af, GUID sc) | 506 | const wchar_t *name, int af, GUID sc) |
@@ -581,7 +574,6 @@ get_ip_from_hostname (struct GNUNET_SERVER_Client *client, | |||
581 | { | 574 | { |
582 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 575 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
583 | "Lookup launched, waiting for a reply\n"); | 576 | "Lookup launched, waiting for a reply\n"); |
584 | GNUNET_SERVER_client_keep (client); | ||
585 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 577 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
586 | } | 578 | } |
587 | else | 579 | else |
@@ -598,6 +590,7 @@ get_ip_from_hostname (struct GNUNET_SERVER_Client *client, | |||
598 | } | 590 | } |
599 | } | 591 | } |
600 | 592 | ||
593 | |||
601 | /** | 594 | /** |
602 | * Handle GET-message. | 595 | * Handle GET-message. |
603 | * | 596 | * |
@@ -649,7 +642,6 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client, | |||
649 | return; | 642 | return; |
650 | } | 643 | } |
651 | get_ip_from_hostname (client, hostname, af, sc); | 644 | get_ip_from_hostname (client, hostname, af, sc); |
652 | return; | ||
653 | } | 645 | } |
654 | 646 | ||
655 | 647 | ||
@@ -746,4 +738,4 @@ main (int argc, char *const *argv) | |||
746 | return ret; | 738 | return ret; |
747 | } | 739 | } |
748 | 740 | ||
749 | /* end of gnunet-gns.c */ | 741 | /* end of gnunet-gns-helper-service-w32.c */ |