#include "gnunet_server_lib.h"
#include "gnunet_time_lib.h"
-#define VERBOSE GNUNET_NO
+#define VERBOSE GNUNET_EXTRA_LOGGING
#define PORT 22335
static void
recv_cb (void *cls, struct GNUNET_SERVER_Client *argclient,
- const struct GNUNET_MessageHeader *message)
+ const struct GNUNET_MessageHeader *message)
{
void *addr;
size_t addrlen;
struct sockaddr_in *have;
GNUNET_assert (GNUNET_OK ==
- GNUNET_SERVER_client_get_address (argclient, &addr, &addrlen));
+ GNUNET_SERVER_client_get_address (argclient, &addr,
+ &addrlen));
GNUNET_assert (addrlen == sizeof (struct sockaddr_in));
have = addr;
GNUNET_assert (0 == memcmp (&sa, addr, addrlen));
GNUNET_free (addr);
switch (ok)
- {
- case 2:
- ok++;
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_MILLISECONDS, 50),
- &send_done, argclient);
- break;
- case 4:
- ok++;
- GNUNET_CLIENT_disconnect (client, GNUNET_YES);
- GNUNET_SERVER_receive_done (argclient, GNUNET_OK);
- break;
- default:
- GNUNET_assert (0);
- }
+ {
+ case 2:
+ ok++;
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_MILLISECONDS, 50),
+ &send_done, argclient);
+ break;
+ case 4:
+ ok++;
+ GNUNET_CLIENT_disconnect (client, GNUNET_YES);
+ GNUNET_SERVER_receive_done (argclient, GNUNET_OK);
+ break;
+ default:
+ GNUNET_assert (0);
+ }
}
sa.sin_family = AF_INET;
sa.sin_port = htons (PORT);
server =
- GNUNET_SERVER_create (NULL, NULL, sap, slens,
- GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_MILLISECONDS, 250), GNUNET_NO);
+ GNUNET_SERVER_create (NULL, NULL, sap, slens,
+ GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_MILLISECONDS, 250), GNUNET_NO);
GNUNET_assert (server != NULL);
handlers[0].callback_cls = cls;
GNUNET_SERVER_add_handlers (server, handlers);
GNUNET_SERVER_disconnect_notify (server, ¬ify_disconnect, cls);
cfg = GNUNET_CONFIGURATION_create ();
GNUNET_CONFIGURATION_set_value_number (cfg, "test", "PORT", PORT);
- GNUNET_CONFIGURATION_set_value_string (cfg, "test", "HOSTNAME", "localhost");
+ GNUNET_CONFIGURATION_set_value_string (cfg, "test", "HOSTNAME",
+ "localhost");
GNUNET_CONFIGURATION_set_value_string (cfg, "resolver", "HOSTNAME",
- "localhost");
+ "localhost");
client = GNUNET_CLIENT_connect ("test", cfg);
GNUNET_assert (client != NULL);
GNUNET_CLIENT_notify_transmit_ready (client, 256,
- GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_MILLISECONDS, 250),
- GNUNET_NO, ¬ify_ready, NULL);
+ GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_MILLISECONDS, 250),
+ GNUNET_NO, ¬ify_ready, NULL);
}
GNUNET_log_setup ("test_server_with_client",
#if VERBOSE
- "DEBUG",
+ "DEBUG",
#else
- "WARNING",
+ "WARNING",
#endif
- NULL);
+ NULL);
ret += check ();
return ret;