diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-03-18 14:24:12 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-03-18 14:24:12 +0000 |
commit | 0d4109b1f08b53e930315d7d21f8eeec892bc105 (patch) | |
tree | cb0b471d316ebb92eeb863a1d696ba8abcea9788 /src | |
parent | a451a2586010ed439a381e2621f29b7c3e197fcf (diff) | |
download | gnunet-0d4109b1f08b53e930315d7d21f8eeec892bc105.tar.gz gnunet-0d4109b1f08b53e930315d7d21f8eeec892bc105.zip |
fix
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/plugin_transport_udp.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 094b207f4..3d57c09a8 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -199,9 +199,8 @@ udp_transport_server_stop (void *cls) | |||
199 | * peer disconnected...) | 199 | * peer disconnected...) |
200 | * @param cont_cls closure for cont | 200 | * @param cont_cls closure for cont |
201 | * | 201 | * |
202 | * @return the number of bytes written | 202 | * @return the number of bytes written, -1 on error (in this case, cont is not called) |
203 | */ | 203 | */ |
204 | |||
205 | static ssize_t | 204 | static ssize_t |
206 | udp_plugin_send (void *cls, | 205 | udp_plugin_send (void *cls, |
207 | const struct GNUNET_PeerIdentity *target, | 206 | const struct GNUNET_PeerIdentity *target, |
@@ -220,15 +219,13 @@ udp_plugin_send (void *cls, | |||
220 | ssize_t sent; | 219 | ssize_t sent; |
221 | 220 | ||
222 | GNUNET_assert(udp_sock != NULL); | 221 | GNUNET_assert(udp_sock != NULL); |
223 | 222 | if ( (addr == NULL) || (addrlen == 0) ) | |
224 | if ((addr == NULL) || (addrlen == 0)) | ||
225 | { | 223 | { |
226 | #if DEBUG_UDP | 224 | #if DEBUG_UDP |
227 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "udp", _ | 225 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "udp", _ |
228 | ("udp_plugin_send called without address, returning!\n")); | 226 | ("udp_plugin_send called without address, returning!\n")); |
229 | #endif | 227 | #endif |
230 | cont (cont_cls, target, GNUNET_OK); | 228 | return -1; /* Can never send if we don't have an address!! */ |
231 | return 0; /* Can never send if we don't have an address!! */ | ||
232 | } | 229 | } |
233 | 230 | ||
234 | /* Build the message to be sent */ | 231 | /* Build the message to be sent */ |
@@ -244,26 +241,13 @@ udp_plugin_send (void *cls, | |||
244 | memcpy (&message->sender, plugin->env->my_identity, | 241 | memcpy (&message->sender, plugin->env->my_identity, |
245 | sizeof (struct GNUNET_PeerIdentity)); | 242 | sizeof (struct GNUNET_PeerIdentity)); |
246 | memcpy (&message[1], msgbuf, msgbuf_size); | 243 | memcpy (&message[1], msgbuf, msgbuf_size); |
247 | |||
248 | /* Actually send the message */ | ||
249 | sent = | 244 | sent = |
250 | GNUNET_NETWORK_socket_sendto (udp_sock, message, ssize, | 245 | GNUNET_NETWORK_socket_sendto (udp_sock, message, ssize, |
251 | addr, | 246 | addr, |
252 | addrlen); | 247 | addrlen); |
253 | 248 | if ( (cont != NULL) && | |
254 | if (cont != NULL) | 249 | (sent != -1) ) |
255 | { | 250 | cont (cont_cls, target, GNUNET_OK); |
256 | if (sent == GNUNET_SYSERR) | ||
257 | cont (cont_cls, target, GNUNET_SYSERR); | ||
258 | else | ||
259 | { | ||
260 | #if DEBUG_UDP | ||
261 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "udp", _ | ||
262 | ("Sucessfully sent message, calling transmit continuation!\n")); | ||
263 | #endif | ||
264 | cont (cont_cls, target, GNUNET_OK); | ||
265 | } | ||
266 | } | ||
267 | GNUNET_free (message); | 251 | GNUNET_free (message); |
268 | return sent; | 252 | return sent; |
269 | } | 253 | } |