}
if (ret == 0) {
+ if (event_pending (&priv->ev, EV_READ, NULL)) {
+ event_del (&priv->ev);
+ }
+
rspamd_http_connection_ref (conn);
ret = conn->finish_handler (conn, priv->msg);
conn->finished = TRUE;
return;
}
else if (r == 0) {
- err = g_error_new (HTTP_ERROR,
- errno,
- "IO read error: unexpected EOF");
- conn->error_handler (conn, err);
- g_error_free (err);
-
- REF_RELEASE (pbuf);
- rspamd_http_connection_unref (conn);
+ if (!conn->finished) {
+ err = g_error_new (HTTP_ERROR,
+ errno,
+ "IO read error: unexpected EOF");
+ conn->error_handler (conn, err);
+ g_error_free (err);
+ REF_RELEASE (pbuf);
+ rspamd_http_connection_unref (conn);
+ }
return;
}
else {