gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r6770 - GNUnet/src/applications/chat


From: gnunet
Subject: [GNUnet-SVN] r6770 - GNUnet/src/applications/chat
Date: Mon, 28 Apr 2008 14:18:05 -0600 (MDT)

Author: nevans
Date: 2008-04-28 14:18:05 -0600 (Mon, 28 Apr 2008)
New Revision: 6770

Modified:
   GNUnet/src/applications/chat/chattest.c
   GNUnet/src/applications/chat/gnunet-chat.c
Log:
better test case

Modified: GNUnet/src/applications/chat/chattest.c
===================================================================
--- GNUnet/src/applications/chat/chattest.c     2008-04-28 14:41:17 UTC (rev 
6769)
+++ GNUnet/src/applications/chat/chattest.c     2008-04-28 20:18:05 UTC (rev 
6770)
@@ -22,6 +22,7 @@
  * @file applications/chat/chattest.c
  * @brief chat testcase, loopback only
  * @author Christian Grothoff
+ * @author Nathan Evans
  */
 
 #include "platform.h"
@@ -30,6 +31,7 @@
 #include "gnunet_testing_lib.h"
 #include "gnunet_stats_lib.h"
 #include "gnunet_util.h"
+#include "gnunet_core.h"
 
 #define START_PEERS 1
 
@@ -91,18 +93,26 @@
 int
 main (int argc, char **argv)
 {
-  struct GNUNET_TESTING_DaemonContext *peers;
+       struct GNUNET_TESTING_DaemonContext *peers;
   int ret;
+  
+  pid_t daemon1;
+  GNUNET_PeerIdentity p1;
+  char *c1 = NULL;
+
   struct GNUNET_CHAT_Room *r1;
   struct GNUNET_CHAT_Room *r2;
 
-  GNUNET_RSA_PublicKey *me = NULL;
-  const struct GNUNET_RSA_PrivateKey *key = NULL;
+  GNUNET_RSA_PublicKey me;
+  struct GNUNET_RSA_PrivateKey *key = NULL;
 
+       
   key = GNUNET_RSA_create_key ();
   GNUNET_RSA_get_public_key (key, &me);
-
+  
   ret = 0;
+  
+  
   cfg = GNUNET_GC_create ();
   if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
     {
@@ -110,37 +120,47 @@
       return -1;
     }
 #if START_PEERS
-  peers = GNUNET_TESTING_start_daemons ("tcp",
+peers = GNUNET_TESTING_start_daemons ("tcp",
                                         "chat stats",
-                                        "/tmp/gnunet-chat-test", 2087, 10, 1);
+                                        "/tmp/gnunet-chat-test/",
+                                        2087, 10, 1);
   if (peers == NULL)
     {
-      fprintf (stderr, "Failed to start the gnunetd daemon!\n");
+      fprintf (stderr, "Failed to start the gnunetd daemons!\n");
       GNUNET_GC_free (cfg);
       return -1;
     }
 #endif
 
+
   r1 =
-    GNUNET_CHAT_join_room (NULL, cfg, "nicktest1", "testroom", me, key, "",
-                           &receive_callback1, NULL, member_list_callback1,
+    GNUNET_CHAT_join_room (NULL, cfg, "nicktest1", "testroom", &me, key, "",
+                           &receive_callback1, NULL, &member_list_callback1,
                            NULL);
 
-  r2 = GNUNET_CHAT_join_room (NULL, cfg, "nicktest2", "testroom", me, key, "",
-                              &receive_callback2, NULL, member_list_callback2,
+  r2 = GNUNET_CHAT_join_room (NULL, cfg, "nicktest2", "testroom", &me, key, "",
+                              &receive_callback2, NULL, &member_list_callback2,
                               NULL);
+       
+       GNUNET_CHAT_send_message (r1, "test message 1", NULL, NULL, 
GNUNET_CHAT_MSG_OPTION_NONE, NULL);
+                                                    
+       GNUNET_CHAT_send_message (r2, "test message 2", NULL, NULL, 
GNUNET_CHAT_MSG_OPTION_NONE, NULL);
+       
+       if (r1 != NULL) 
+       GNUNET_CHAT_leave_room (r1);
+  if (r2 != NULL)      
+       GNUNET_CHAT_leave_room (r2);
 
-  GNUNET_CHAT_leave_room (r1);
-  GNUNET_CHAT_leave_room (r2);
 
-  GNUNET_shutdown_wait_for ();
 
 #if START_PEERS
-  GNUNET_TESTING_stop_daemons (peers);
+       GNUNET_TESTING_stop_daemons (peers);
 #endif
-
+  //GNUNET_shutdown_wait_for ();
   GNUNET_GC_free (cfg);
-  return 0;
+  
+  
+       return 0;  
 }
 
 /* end of chattest.c */

Modified: GNUnet/src/applications/chat/gnunet-chat.c
===================================================================
--- GNUnet/src/applications/chat/gnunet-chat.c  2008-04-28 14:41:17 UTC (rev 
6769)
+++ GNUnet/src/applications/chat/gnunet-chat.c  2008-04-28 20:18:05 UTC (rev 
6770)
@@ -153,8 +153,8 @@
       return -1;
     }
 
-  fprintf (stderr, "Generating public/private key pair\n");
-  /* FIXME: try to read key from disk! */
+  
+  
   my_priv = NULL;
   my_priv = GNUNET_CHAT_initPrivateKey (ectx, cfg, room_name, &my_pub);
   if (my_priv == NULL)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]