aboutsummaryrefslogtreecommitdiff
path: root/src/util/socks.c
diff options
context:
space:
mode:
authorJeff Burdges <burdges@gnunet.org>2015-08-03 08:18:52 +0000
committerJeff Burdges <burdges@gnunet.org>2015-08-03 08:18:52 +0000
commitcf5a23aa7d5d939038b78ff6ce47ceb5665281bb (patch)
tree8fbf61fc0664b69b5a805fead8e285df4328757b /src/util/socks.c
parent2587d268f7c92b09bfc1b0130105b378d6055329 (diff)
downloadgnunet-cf5a23aa7d5d939038b78ff6ce47ceb5665281bb.tar.gz
gnunet-cf5a23aa7d5d939038b78ff6ce47ceb5665281bb.zip
Add test code, but it's still segfaulting.
Diffstat (limited to 'src/util/socks.c')
-rw-r--r--src/util/socks.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/util/socks.c b/src/util/socks.c
index d90fa26d1..d54a086f9 100644
--- a/src/util/socks.c
+++ b/src/util/socks.c
@@ -274,6 +274,7 @@ SOCKS5_handshake_step (struct GNUNET_SOCKS_Handshake *ih)
274 case SOCKS5_step_done: 274 case SOCKS5_step_done:
275 GNUNET_assert (0); 275 GNUNET_assert (0);
276 } 276 }
277 ++ih->step;
277 ih->instart = b; 278 ih->instart = b;
278 /* Do not reschedule the sender unless we're done reading. 279 /* Do not reschedule the sender unless we're done reading.
279 * I imagine this lets us avoid ever cancelling the transmit handle. */ 280 * I imagine this lets us avoid ever cancelling the transmit handle. */
@@ -294,6 +295,7 @@ reciever (void *cls,
294 const struct sockaddr * addr, 295 const struct sockaddr * addr,
295 socklen_t addrlen, int errCode) 296 socklen_t addrlen, int errCode)
296{ 297{
298printf("Meow(%d)",available);
297 struct GNUNET_SOCKS_Handshake * ih = cls; 299 struct GNUNET_SOCKS_Handshake * ih = cls;
298 GNUNET_assert (&ih->inend[available] < &ih->inbuf[1024]); 300 GNUNET_assert (&ih->inend[available] < &ih->inbuf[1024]);
299 memcpy(ih->inend, buf, available); 301 memcpy(ih->inend, buf, available);
@@ -312,6 +314,7 @@ reciever (void *cls,
312void 314void
313register_reciever (struct GNUNET_SOCKS_Handshake *ih, int want) 315register_reciever (struct GNUNET_SOCKS_Handshake *ih, int want)
314{ 316{
317 printf("register_reciever on step %u for %d bytes.\n", ih->step, want );
315 GNUNET_CONNECTION_receive (ih->socks5_connection, 318 GNUNET_CONNECTION_receive (ih->socks5_connection,
316 want, 319 want,
317 GNUNET_TIME_relative_get_minute_ (), 320 GNUNET_TIME_relative_get_minute_ (),
@@ -381,12 +384,13 @@ transmit_ready (void *cls,
381 GNUNET_assert (1024 >= size && size > 0); 384 GNUNET_assert (1024 >= size && size > 0);
382 GNUNET_assert (SOCKS5_step_done > ih->step && ih->step >= 0); 385 GNUNET_assert (SOCKS5_step_done > ih->step && ih->step >= 0);
383 unsigned char * b = ih->outstep[ih->step]; 386 unsigned char * b = ih->outstep[ih->step];
384 unsigned char * e = ih->outstep[ih->step++]; 387 unsigned char * e = ih->outstep[ih->step+1];
385 GNUNET_assert (e <= &ih->outbuf[1024]); 388 GNUNET_assert (e <= &ih->outbuf[1024]);
386 unsigned l = e - b; 389 unsigned l = e - b;
387 GNUNET_assert (size >= l && l >= 0); 390 GNUNET_assert (size >= l && l >= 0);
388 memcpy(b, buf, l); 391 memcpy(buf, b, l);
389 register_reciever (ih, register_reciever_wants(ih)); 392 register_reciever (ih, register_reciever_wants(ih));
393 printf("sent(%d)\n",l);
390 return l; 394 return l;
391} 395}
392 396