projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix memleak
[oweals/gnunet.git]
/
src
/
chat
/
test_chat.c
diff --git
a/src/chat/test_chat.c
b/src/chat/test_chat.c
index b4e14f08189c349dc9bd85e4cebeaab6d8480236..24a1e38da8551cbebd64c6c8745252c52be51fb0 100644
(file)
--- a/
src/chat/test_chat.c
+++ b/
src/chat/test_chat.c
@@
-37,7
+37,7
@@
#include "gnunet_arm_service.h"
#include "gnunet_chat_service.h"
#include "gnunet_arm_service.h"
#include "gnunet_chat_service.h"
-#define VERBOSE GNUNET_
EXTRA_LOGGING
+#define VERBOSE GNUNET_
NO
#define START_ARM GNUNET_YES
#define START_ARM GNUNET_YES
@@
-58,7
+58,7
@@
struct Wanted
{
struct GNUNET_CONTAINER_MetaData *meta;
{
struct GNUNET_CONTAINER_MetaData *meta;
- GNUNET_HashCode *sender;
+
struct
GNUNET_HashCode *sender;
char *msg;
char *msg;
@@
-80,9
+80,9
@@
static struct PeerContext p1;
static struct PeerContext p2;
static struct PeerContext p2;
-static GNUNET_HashCode alice;
+static
struct
GNUNET_HashCode alice;
-static GNUNET_HashCode bob;
+static
struct
GNUNET_HashCode bob;
static struct GNUNET_CHAT_Room *alice_room;
static struct GNUNET_CHAT_Room *alice_room;
@@
-116,17
+116,18
@@
static int is_auth;
static void
setup_peer (struct PeerContext *p, const char *cfgname)
{
static void
setup_peer (struct PeerContext *p, const char *cfgname)
{
+ char *binary;
+
+ binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
p->cfg = GNUNET_CONFIGURATION_create ();
#if START_ARM
p->arm_proc =
p->cfg = GNUNET_CONFIGURATION_create ();
#if START_ARM
p->arm_proc =
-
GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm"
,
+
GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary
,
"gnunet-service-arm",
"gnunet-service-arm",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
"-c", cfgname, NULL);
#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
"-c", cfgname, NULL);
#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
+ GNUNET_free (binary);
}
}
@@
-140,7
+141,7
@@
stop_arm (struct PeerContext *p)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM process %u stopped\n",
GNUNET_OS_process_get_pid (p->arm_proc));
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM process %u stopped\n",
GNUNET_OS_process_get_pid (p->arm_proc));
- GNUNET_OS_process_
close
(p->arm_proc);
+ GNUNET_OS_process_
destroy
(p->arm_proc);
p->arm_proc = NULL;
#endif
GNUNET_CONFIGURATION_destroy (p->cfg);
p->arm_proc = NULL;
#endif
GNUNET_CONFIGURATION_destroy (p->cfg);
@@
-201,7
+202,7
@@
member_list_cb (void *cls, const struct GNUNET_CONTAINER_MetaData *member_info,
enum GNUNET_CHAT_MsgOptions options)
{
struct Wanted *want = cls;
enum GNUNET_CHAT_MsgOptions options)
{
struct Wanted *want = cls;
- GNUNET_HashCode sender;
+
struct
GNUNET_HashCode sender;
#if VERBOSE
printf ("%s - told that %s has %s\n", want->me,
#if VERBOSE
printf ("%s - told that %s has %s\n", want->me,
@@
-213,7
+214,7
@@
member_list_cb (void *cls, const struct GNUNET_CONTAINER_MetaData *member_info,
GNUNET_CRYPTO_hash (member_id,
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
&sender);
GNUNET_CRYPTO_hash (member_id,
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
&sender);
- if ((0 == memcmp (&sender, want->sender, sizeof (GNUNET_HashCode))) &&
+ if ((0 == memcmp (&sender, want->sender, sizeof (
struct
GNUNET_HashCode))) &&
(((member_info == NULL) && (want->meta == NULL)) ||
((member_info != NULL) && (want->meta != NULL) &&
(GNUNET_CONTAINER_meta_data_test_equal (member_info, want->meta)))) &&
(((member_info == NULL) && (want->meta == NULL)) ||
((member_info != NULL) && (want->meta != NULL) &&
(GNUNET_CONTAINER_meta_data_test_equal (member_info, want->meta)))) &&
@@
-234,7
+235,7
@@
member_list_cb (void *cls, const struct GNUNET_CONTAINER_MetaData *member_info,
static int
receive_cb (void *cls, struct GNUNET_CHAT_Room *room,
static int
receive_cb (void *cls, struct GNUNET_CHAT_Room *room,
- const GNUNET_HashCode * sender,
+ const
struct
GNUNET_HashCode * sender,
const struct GNUNET_CONTAINER_MetaData *meta, const char *message,
struct GNUNET_TIME_Absolute timestamp,
enum GNUNET_CHAT_MsgOptions options)
const struct GNUNET_CONTAINER_MetaData *meta, const char *message,
struct GNUNET_TIME_Absolute timestamp,
enum GNUNET_CHAT_MsgOptions options)
@@
-250,7
+251,7
@@
receive_cb (void *cls, struct GNUNET_CHAT_Room *room,
if ((0 == strcmp (message, want->msg)) &&
(((sender == NULL) && (want->sender == NULL)) ||
((sender != NULL) && (want->sender != NULL) &&
if ((0 == strcmp (message, want->msg)) &&
(((sender == NULL) && (want->sender == NULL)) ||
((sender != NULL) && (want->sender != NULL) &&
- (0 == memcmp (sender, want->sender, sizeof (GNUNET_HashCode))))) &&
+ (0 == memcmp (sender, want->sender, sizeof (
struct
GNUNET_HashCode))))) &&
(GNUNET_CONTAINER_meta_data_test_equal (meta, want->meta)) &&
(options == want->opt) &&
/* Not == since the library sets the actual timestamp, so it may be
(GNUNET_CONTAINER_meta_data_test_equal (meta, want->meta)) &&
(options == want->opt) &&
/* Not == since the library sets the actual timestamp, so it may be
@@
-275,7
+276,7
@@
static int
confirmation_cb (void *cls, struct GNUNET_CHAT_Room *room,
uint32_t orig_seq_number,
struct GNUNET_TIME_Absolute timestamp,
confirmation_cb (void *cls, struct GNUNET_CHAT_Room *room,
uint32_t orig_seq_number,
struct GNUNET_TIME_Absolute timestamp,
- const GNUNET_HashCode * receiver)
+ const
struct
GNUNET_HashCode * receiver)
{
struct Wanted *want = cls;
{
struct Wanted *want = cls;
@@
-285,7
+286,7
@@
confirmation_cb (void *cls, struct GNUNET_CHAT_Room *room,
EXTRACTOR_METATYPE_TITLE),
orig_seq_number);
#endif
EXTRACTOR_METATYPE_TITLE),
orig_seq_number);
#endif
- if ((0 == memcmp (receiver, want->sender, sizeof (GNUNET_HashCode))) &&
+ if ((0 == memcmp (receiver, want->sender, sizeof (
struct
GNUNET_HashCode))) &&
(orig_seq_number == want->sequence_number) &&
(timestamp.abs_value >= want->timestamp.abs_value))
{
(orig_seq_number == want->sequence_number) &&
(timestamp.abs_value >= want->timestamp.abs_value))
{