r = send (req->sock, req->packet, req->pos, 0);
if (r == -1) {
if (errno == EAGAIN) {
- event_del (&req->io_event);
event_set (&req->io_event, req->sock, EV_WRITE, dns_retransmit_handler, req);
event_add (&req->io_event, &req->tv);
register_async_event (req->session, (event_finalizer_t)event_del, &req->io_event, FALSE);
}
}
else if (r < req->pos) {
- event_del (&req->io_event);
event_set (&req->io_event, req->sock, EV_WRITE, dns_retransmit_handler, req);
event_add (&req->io_event, &req->tv);
register_async_event (req->session, (event_finalizer_t)event_del, &req->io_event, FALSE);
evtimer_add (&req->timer_event, &req->tv);
r = send_dns_request (req);
if (r == -1) {
- event_del (&req->io_event);
rep = memory_pool_alloc0 (req->pool, sizeof (struct rspamd_dns_reply));
rep->request = req;
rep->code = DNS_RC_SERVFAIL;
if (what == EV_WRITE) {
/* Retransmit dns request */
req->retransmits ++;
+ event_del (&req->io_event);
if (req->retransmits >= req->resolver->max_retransmits) {
msg_err ("maximum number of retransmits expired for %s", req->requested_name);
- event_del (&req->io_event);
rep = memory_pool_alloc0 (req->pool, sizeof (struct rspamd_dns_reply));
rep->request = req;
rep->code = DNS_RC_SERVFAIL;
}
r = send_dns_request (req);
if (r == -1) {
- event_del (&req->io_event);
rep = memory_pool_alloc0 (req->pool, sizeof (struct rspamd_dns_reply));
rep->request = req;
rep->code = DNS_RC_SERVFAIL;
/* Fill timeout */
msec_to_tv (resolver->request_timeout, &req->tv);
+ evtimer_set (&req->timer_event, dns_timer_cb, req);
/* Now send request to server */
r = send_dns_request (req);
if (r == 1) {
/* Add timer event */
- evtimer_set (&req->timer_event, dns_timer_cb, req);
evtimer_add (&req->timer_event, &req->tv);
/* Add request to hash table */
goto err;
}
else {
+ event_del (&session->ev);
event_set (&session->ev, fd, EV_READ, fuzzy_io_callback, session);
event_add (&session->ev, &session->tv);
}
goto err;
}
else {
+ event_del (&session->ev);
event_set (&session->ev, fd, EV_READ, fuzzy_learn_callback, session);
event_add (&session->ev, &session->tv);
}