- //struct GNUNET_NAT_Test *tst = cls;
- unsigned char reply_buf[1024];
- ssize_t rlen;
- struct sockaddr_in answer;
-
- if ((0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) &&
- (GNUNET_NETWORK_fdset_isset (tc->read_ready,
- lsock4)))
- {
- rlen = GNUNET_NETWORK_socket_recv (lsock4, reply_buf, sizeof (reply_buf));
-
-
- //Lets handle the packet
- memset(&answer, 0, sizeof(struct sockaddr_in));
-
- if(GNUNET_OK == GNUNET_NAT_stun_handle_packet(reply_buf, rlen, &answer))
- {
- //Print the answer
- ret = 0;
- print_answer(&answer);
-
- //Destroy the connection
- GNUNET_NETWORK_socket_close(lsock4);
- lsock4 = NULL;
-
- }
- else
- {
- //Lets try again, its a invalid message
- ltask4 = GNUNET_SCHEDULER_add_read_net (TIMEOUT,
- lsock4, &do_udp_read, NULL);
- }
-
- }
- else
+ //struct GNUNET_NAT_Test *tst = cls;
+ unsigned char reply_buf[1024];
+ ssize_t rlen;
+ struct sockaddr_in answer;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ ltask4 = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
+ if ( (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) ||
+ (! GNUNET_NETWORK_fdset_isset (tc->read_ready,
+ lsock4)) )