summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/rspamd_http_test.c17
-rw-r--r--test/rspamd_upstream_test.c13
2 files changed, 15 insertions, 15 deletions
diff --git a/test/rspamd_http_test.c b/test/rspamd_http_test.c
index ab465638c..324ad8e44 100644
--- a/test/rspamd_http_test.c
+++ b/test/rspamd_http_test.c
@@ -51,7 +51,7 @@ static void
rspamd_server_accept (gint fd, short what, void *arg)
{
struct rspamd_http_connection_router *rt = arg;
- rspamd_inet_addr_t addr;
+ rspamd_inet_addr_t *addr;
gint nfd;
if ((nfd =
@@ -64,6 +64,7 @@ rspamd_server_accept (gint fd, short what, void *arg)
return;
}
+ rspamd_inet_address_destroy (addr);
rspamd_http_router_handle_socket (rt, nfd, NULL);
}
@@ -206,7 +207,7 @@ rspamd_http_test_func (void)
gpointer serv_key, client_key, peer_key;
struct rspamd_keypair_cache *c;
rspamd_mempool_mutex_t *mtx;
- rspamd_inet_addr_t addr;
+ rspamd_inet_addr_t *addr;
gdouble ts1, ts2;
gchar filepath[PATH_MAX], buf[512];
gint fd, i, j;
@@ -226,7 +227,7 @@ rspamd_http_test_func (void)
mtx = rspamd_mempool_get_mutex (pool);
rspamd_parse_inet_address (&addr, "127.0.0.1");
- rspamd_inet_address_set_port (&addr, ottery_rand_range (30000) + 32768);
+ rspamd_inet_address_set_port (addr, ottery_rand_range (30000) + 32768);
serv_key = rspamd_http_connection_gen_key ();
client_key = rspamd_http_connection_gen_key ();
c = rspamd_keypair_cache_new (16);
@@ -236,7 +237,7 @@ rspamd_http_test_func (void)
g_assert (sfd != -1);
if (sfd == 0) {
- rspamd_http_server_func ("/tmp/", &addr, mtx, serv_key, c);
+ rspamd_http_server_func ("/tmp/", addr, mtx, serv_key, c);
exit (EXIT_SUCCESS);
}
@@ -245,7 +246,7 @@ rspamd_http_test_func (void)
/* Do client stuff */
for (i = 0; i < ntests; i ++) {
for (j = 0; j < pconns; j ++) {
- rspamd_http_client_func (filepath + sizeof ("/tmp") - 1, &addr,
+ rspamd_http_client_func (filepath + sizeof ("/tmp") - 1, addr,
NULL, NULL, c, ev_base, &latency[i * pconns + j]);
}
ts1 = rspamd_get_ticks ();
@@ -273,7 +274,7 @@ rspamd_http_test_func (void)
for (i = 0; i < ntests; i ++) {
for (j = 0; j < pconns; j ++) {
- rspamd_http_client_func (filepath + sizeof ("/tmp") - 1, &addr,
+ rspamd_http_client_func (filepath + sizeof ("/tmp") - 1, addr,
client_key, peer_key, c, ev_base, &latency[i * pconns + j]);
}
ts1 = rspamd_get_ticks ();
@@ -298,7 +299,7 @@ rspamd_http_test_func (void)
g_assert (sfd != -1);
if (sfd == 0) {
- rspamd_http_server_func ("/tmp/", &addr, mtx, serv_key, NULL);
+ rspamd_http_server_func ("/tmp/", addr, mtx, serv_key, NULL);
exit (EXIT_SUCCESS);
}
@@ -307,7 +308,7 @@ rspamd_http_test_func (void)
for (i = 0; i < ntests; i ++) {
for (j = 0; j < pconns; j ++) {
- rspamd_http_client_func (filepath + sizeof ("/tmp") - 1, &addr,
+ rspamd_http_client_func (filepath + sizeof ("/tmp") - 1, addr,
client_key, peer_key, c, ev_base, &latency[i * pconns + j]);
}
ts1 = rspamd_get_ticks ();
diff --git a/test/rspamd_upstream_test.c b/test/rspamd_upstream_test.c
index 23a450ec4..bc8332c79 100644
--- a/test/rspamd_upstream_test.c
+++ b/test/rspamd_upstream_test.c
@@ -72,7 +72,7 @@ rspamd_upstream_test_func (void)
gdouble p;
struct event ev;
struct timeval tv;
- rspamd_inet_addr_t *addr, *next_addr, paddr;
+ rspamd_inet_addr_t *addr, *next_addr, *paddr;
cfg = (struct rspamd_config *)g_malloc (sizeof (struct rspamd_config));
bzero (cfg, sizeof (struct rspamd_config));
@@ -138,17 +138,16 @@ rspamd_upstream_test_func (void)
nls = rspamd_upstreams_create ();
g_assert (rspamd_upstreams_add_upstream (nls, "127.0.0.1", 0, NULL));
up = rspamd_upstream_get (nls, RSPAMD_UPSTREAM_RANDOM);
- addr = g_malloc (sizeof (*addr));
rspamd_parse_inet_address(&paddr, "127.0.0.2");
- g_assert (rspamd_upstream_add_addr (up, &paddr));
+ g_assert (rspamd_upstream_add_addr (up, paddr));
rspamd_parse_inet_address(&paddr, "::1");
- g_assert (rspamd_upstream_add_addr (up, &paddr));
+ g_assert (rspamd_upstream_add_addr (up, paddr));
addr = rspamd_upstream_addr (up);
for (i = 0; i < 256; i ++) {
next_addr = rspamd_upstream_addr (up);
- g_assert (addr->af == AF_INET);
- g_assert (next_addr->af == AF_INET);
- g_assert (addr != next_addr);
+ g_assert (rspamd_inet_address_get_af (addr) == AF_INET);
+ g_assert (rspamd_inet_address_get_af (next_addr) == AF_INET);
+ g_assert (rspamd_inet_address_compare (addr, next_addr) != 0);
addr = next_addr;
}
rspamd_upstreams_destroy (nls);