#undef MAP_DEBUG_REFS
#ifdef MAP_DEBUG_REFS
-#define MAP_RETAIN(x) do { \
- msg_err ("retain ref %p, refcount: %d -> %d", (x), (x)->ref.refcount, (x)->ref.refcount + 1); \
+#define MAP_RETAIN(x, t) do { \
+ msg_err (G_GNUC_PRETTY_FUNCTION ": " t ": retain ref %p, refcount: %d -> %d", (x), (x)->ref.refcount, (x)->ref.refcount + 1); \
REF_RETAIN(x); \
} while (0)
-#define MAP_RELEASE(x) do { \
- msg_err ("release ref %p, refcount: %d -> %d", (x), (x)->ref.refcount, (x)->ref.refcount - 1); \
+#define MAP_RELEASE(x, t) do { \
+ msg_err (G_GNUC_PRETTY_FUNCTION ": " t ": release ref %p, refcount: %d -> %d", (x), (x)->ref.refcount, (x)->ref.refcount - 1); \
REF_RELEASE(x); \
} while (0)
#else
-#define MAP_RETAIN REF_RETAIN
-#define MAP_RELEASE REF_RELEASE
+#define MAP_RETAIN(x, t) REF_RETAIN(x)
+#define MAP_RELEASE(x, t) REF_RELEASE(x)
#endif
static const gchar *hash_fill = "1";
rspamd_http_connection_write_message (cbd->conn, msg, cbd->data->host,
NULL, cbd, cbd->fd, &cbd->tv, cbd->ev_base);
- MAP_RETAIN (cbd);
+ MAP_RETAIN (cbd, "http_callback_data");
}
else {
msg_err_map ("cannot connect to %s: %s", cbd->data->host,
rspamd_inet_address_destroy (cbd->addr);
}
- MAP_RELEASE (cbd->bk);
- MAP_RELEASE (periodic);
+ MAP_RELEASE (cbd->bk, "rspamd_map_backend");
+ MAP_RELEASE (periodic, "periodic");
g_slice_free1 (sizeof (struct http_callback_data), cbd);
}
cbd->periodic->errored = TRUE;
msg_err_map ("connection with http server terminated incorrectly: %e", err);
rspamd_map_periodic_callback (-1, EV_TIMEOUT, cbd->periodic);
- MAP_RELEASE (cbd);
+ MAP_RELEASE (cbd, "http_callback_data");
}
static void
struct rspamd_http_map_cached_cbdata *cache_cbd = ud;
g_atomic_int_set (&cache_cbd->map->cache->available, 0);
- REF_RELEASE (cache_cbd->shm);
+ MAP_RELEASE (cache_cbd->shm, "rspamd_http_map_cached_cbdata");
event_del (&cache_cbd->timeout);
g_slice_free1 (sizeof (*cache_cbd), cache_cbd);
}
/* Reset the whole chain */
cbd->periodic->cur_backend = 0;
rspamd_map_periodic_callback (-1, EV_TIMEOUT, cbd->periodic);
- MAP_RELEASE (cbd);
+ MAP_RELEASE (cbd, "http_callback_data");
return 0;
}
cbd->data_len = msg->body_buf.len;
rspamd_http_connection_reset (cbd->conn);
write_http_request (cbd);
- MAP_RELEASE (cbd);
+ MAP_RELEASE (cbd, "http_callback_data");
return 0;
}
cbd->stage = map_load_signature;
rspamd_http_connection_reset (cbd->conn);
write_http_request (cbd);
- MAP_RELEASE (cbd);
+ MAP_RELEASE (cbd, "http_callback_data");
return 0;
}
cache_cbd = g_slice_alloc0 (sizeof (*cache_cbd));
cache_cbd->shm = cbd->shmem_data;
cache_cbd->map = map;
- REF_RETAIN (cache_cbd->shm);
+ MAP_RETAIN (cache_cbd->shm, "shmem_data");
event_set (&cache_cbd->timeout, -1, EV_TIMEOUT, rspamd_map_cache_cb,
cache_cbd);
event_base_set (cbd->ev_base, &cache_cbd->timeout);
bk->uri, cbd->data->host, msg->code);
}
- MAP_RELEASE (cbd);
+ MAP_RELEASE (cbd, "http_callback_data");
return 0;
err:
cbd->periodic->errored = 1;
rspamd_map_periodic_callback (-1, EV_TIMEOUT, cbd->periodic);
- MAP_RELEASE (cbd);
+ MAP_RELEASE (cbd, "http_callback_data");
return 0;
}
}
}
- MAP_RELEASE (cbd);
+ MAP_RELEASE (cbd, "http_callback_data");
}
static gboolean
cbd->fd = -1;
cbd->check = check;
cbd->periodic = periodic;
- MAP_RETAIN (periodic);
+ MAP_RETAIN (periodic, "periodic");
cbd->bk = bk;
- MAP_RETAIN (bk);
+ MAP_RETAIN (bk, "rspamd_map_backend");
cbd->stage = map_resolve_host2;
double_to_tv (map->cfg->map_timeout, &cbd->tv);
REF_INIT_RETAIN (cbd, free_http_cbdata);
if (rdns_make_request_full (map->r->r, rspamd_map_dns_callback, cbd,
map->cfg->dns_timeout, map->cfg->dns_retransmits, 1,
data->host, RDNS_REQUEST_A)) {
- MAP_RETAIN (cbd);
+ MAP_RETAIN (cbd, "http_callback_data");
}
if (rdns_make_request_full (map->r->r, rspamd_map_dns_callback, cbd,
map->cfg->dns_timeout, map->cfg->dns_retransmits, 1,
data->host, RDNS_REQUEST_AAAA)) {
- MAP_RETAIN (cbd);
+ MAP_RETAIN (cbd, "http_callback_data");
}
map->dtor = free_http_cbdata_dtor;
}
/* We don't need own ref as it is now ref counted by DNS handlers */
- MAP_RELEASE (cbd);
+ MAP_RELEASE (cbd, "http_callback_data");
}
static void
/* We should not check other backends if some backend has failed */
rspamd_map_schedule_periodic (cbd->map, FALSE, FALSE, TRUE);
g_atomic_int_set (cbd->map->locked, 0);
- MAP_RELEASE (cbd);
+ MAP_RELEASE (cbd, "periodic");
return;
}
/* For each backend we need to check for modifications */
if (cbd->cur_backend >= cbd->map->backends->len) {
/* Last backend */
- MAP_RELEASE (cbd);
+ MAP_RELEASE (cbd, "periodic");
return;
}
for (i = 0; i < map->backends->len; i ++) {
bk = g_ptr_array_index (map->backends, i);
- MAP_RELEASE (bk);
+ MAP_RELEASE (bk, "rspamd_map_backend");
}
if (map->dtor) {
return bk;
err:
- MAP_RELEASE (bk);
+ MAP_RELEASE (bk, "rspamd_map_backend");
if (hdata) {
g_slice_free1 (sizeof (*hdata), hdata);