GPtrArray *commands;
struct rspamd_task *task;
struct upstream *server;
+ rspamd_inet_addr_t *addr;
struct fuzzy_rule *rule;
struct event ev;
struct event timev;
GError **err;
struct rspamd_http_connection_entry *http_entry;
struct upstream *server;
+ rspamd_inet_addr_t *addr;
struct fuzzy_rule *rule;
struct rspamd_task *task;
struct event ev;
}
else if (ret == return_error) {
/* Error state */
- msg_err_task ("got error on IO with server %s, on %s, %d, %s",
+ msg_err_task ("got error on IO with server %s(%s), on %s, %d, %s",
rspamd_upstream_name (session->server),
+ rspamd_inet_address_to_string (session->addr),
session->state == 1 ? "read" : "write",
errno,
strerror (errno));
}
if (session->retransmits >= fuzzy_module_ctx->retransmits) {
- msg_err_task ("got IO timeout with server %s, after %d retransmits",
+ msg_err_task ("got IO timeout with server %s(%s), after %d retransmits",
rspamd_upstream_name (session->server),
+ rspamd_inet_address_to_string (session->addr),
session->retransmits);
rspamd_upstream_fail (session->server);
rspamd_session_remove_event (session->task->s, fuzzy_io_fin, session);
return;
}
else if (ret == return_error) {
- msg_err_task ("got error in IO with server %s, %d, %s",
- rspamd_upstream_name (session->server), errno, strerror (errno));
+ msg_err_task ("got error in IO with server %s(%s), %d, %s",
+ rspamd_upstream_name (session->server),
+ rspamd_inet_address_to_string (session->addr),
+ errno, strerror (errno));
rspamd_upstream_fail (session->server);
}
rspamd_upstream_fail (session->server);
rspamd_controller_send_error (session->http_entry,
500, "IO timeout with fuzzy storage");
- msg_err_task ("got IO timeout with server %s, after %d retransmits",
+ msg_err_task ("got IO timeout with server %s(%s), after %d retransmits",
rspamd_upstream_name (session->server),
+ rspamd_inet_address_to_string (session->addr),
session->retransmits);
if (*session->saved > 0 ) {
{
struct fuzzy_client_session *session;
struct upstream *selected;
+ rspamd_inet_addr_t *addr;
gint sock;
/* Get upstream */
selected = rspamd_upstream_get (rule->servers, RSPAMD_UPSTREAM_ROUND_ROBIN,
NULL, 0);
if (selected) {
- if ((sock = rspamd_inet_address_connect (rspamd_upstream_addr (selected),
- SOCK_DGRAM, TRUE)) == -1) {
- msg_warn_task ("cannot connect to %s, %d, %s",
+ addr = rspamd_upstream_addr (selected);
+ if ((sock = rspamd_inet_address_connect (addr, SOCK_DGRAM, TRUE)) == -1) {
+ msg_warn_task ("cannot connect to %s(%s), %d, %s",
rspamd_upstream_name (selected),
+ rspamd_inet_address_to_string (addr),
errno,
strerror (errno));
rspamd_upstream_fail (selected);
session->fd = sock;
session->server = selected;
session->rule = rule;
+ session->addr = addr;
event_set (&session->ev, sock, EV_WRITE, fuzzy_check_io_callback,
session);
{
struct fuzzy_learn_session *s;
struct upstream *selected;
+ rspamd_inet_addr_t *addr;
struct rspamd_controller_session *session = entry->ud;
gint sock;
gboolean ret = FALSE;
while ((selected = rspamd_upstream_get (rule->servers,
RSPAMD_UPSTREAM_SEQUENTIAL, NULL, 0))) {
/* Create UDP socket */
- if ((sock = rspamd_inet_address_connect (rspamd_upstream_addr (selected),
+ addr = rspamd_upstream_addr (selected);
+
+ if ((sock = rspamd_inet_address_connect (addr,
SOCK_DGRAM, TRUE)) == -1) {
rspamd_upstream_fail (selected);
}
msec_to_tv (fuzzy_module_ctx->io_timeout, &s->tv);
s->task = task;
+ s->addr = addr;
s->commands = commands;
s->http_entry = entry;
s->server = selected;