[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17019 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17019 - gnunet/src/transport |
Date: |
Mon, 26 Sep 2011 18:58:08 +0200 |
Author: wachs
Date: 2011-09-26 18:58:08 +0200 (Mon, 26 Sep 2011)
New Revision: 17019
Modified:
gnunet/src/transport/gnunet-transport-connect-running-peers.c
Log:
can now send a message
Modified: gnunet/src/transport/gnunet-transport-connect-running-peers.c
===================================================================
--- gnunet/src/transport/gnunet-transport-connect-running-peers.c
2011-09-26 16:57:23 UTC (rev 17018)
+++ gnunet/src/transport/gnunet-transport-connect-running-peers.c
2011-09-26 16:58:08 UTC (rev 17019)
@@ -92,7 +92,7 @@
}
static void
-end ()
+end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");
@@ -152,13 +152,13 @@
(sizeof (struct GNUNET_MessageHeader) == ntohs (message->size)))
{
ok = 0;
- end ();
+ end (NULL, NULL);
}
else
{
GNUNET_break (0);
ok = 1;
- end ();
+ end (NULL, NULL);
}
}
@@ -168,10 +168,20 @@
{
struct PeerContext *p = cls;
struct GNUNET_MessageHeader *hdr;
+ char t;
th = NULL;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Press <q> to quit or any key to transmit a message\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ scanf("%c", &t);
+ if (t == 'q')
+ {
+ GNUNET_SCHEDULER_add_now(&end, NULL);
+ return 0;
+ }
+
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Transmitting message with %u bytes to peer %s\n",
sizeof (struct GNUNET_MessageHeader), GNUNET_i2s (&p->id));
GNUNET_assert (size >= 256);
@@ -182,6 +192,10 @@
hdr->size = htons (sizeof (struct GNUNET_MessageHeader));
hdr->type = htons (MTYPE);
}
+
+ th = GNUNET_TRANSPORT_notify_transmit_ready (p1->th, &p2->id, 256, 0,
TIMEOUT,
+ ¬ify_ready, p1);
+
return sizeof (struct GNUNET_MessageHeader);
}
@@ -278,6 +292,7 @@
GNUNET_free (p1_c);
// FIXME: THIS IS REQUIRED! SEEMS TO BE A BUG!
+
send_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &sendtask, NULL);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17019 - gnunet/src/transport,
gnunet <=