Skip to content

Commit

Permalink
[Fix] Do not pollute public headers with libev internals
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Sep 13, 2023
1 parent 1adcfb1 commit ac2ee05
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/libserver/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "dns.h"
#include "rspamd.h"
#include "utlist.h"
#include "contrib/libev/ev.h"
#include "contrib/librdns/rdns.h"
#include "contrib/librdns/dns_private.h"
#include "contrib/librdns/rdns_ev.h"
Expand Down
9 changes: 5 additions & 4 deletions src/libserver/dns.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*-
* Copyright 2016 Vsevolod Stakhov
/*
* Copyright 2023 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -31,13 +31,14 @@ extern "C" {

struct rspamd_config;
struct rspamd_task;
struct event_loop;

struct rspamd_dns_resolver {
struct rdns_resolver *r;
struct ev_loop *event_loop;
rspamd_lru_hash_t *fails_cache;
void *uidna;
ev_tstamp fails_cache_time;
double fails_cache_time;
struct upstream_list *ups;
struct rspamd_config *cfg;
gdouble request_timeout;
Expand Down
7 changes: 4 additions & 3 deletions src/libutil/upstream.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*-
* Copyright 2016 Vsevolod Stakhov
/*
* Copyright 2023 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -21,6 +21,7 @@
#include "rdns.h"
#include "cryptobox.h"
#include "utlist.h"
#include "contrib/libev/ev.h"
#include "logger.h"
#include "contrib/librdns/rdns.h"
#include "contrib/mumhash/mum.h"
Expand Down
19 changes: 19 additions & 0 deletions src/libutil/upstream.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2023 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef UPSTREAM_H
#define UPSTREAM_H

Expand All @@ -10,6 +26,9 @@
extern "C" {
#endif

/* Forward declaration */
struct ev_loop;

enum rspamd_upstream_rotation {
RSPAMD_UPSTREAM_RANDOM = 0,
RSPAMD_UPSTREAM_HASHED,
Expand Down
1 change: 1 addition & 0 deletions src/libutil/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "ottery.h"
#include "cryptobox.h"
#include "contrib/libev/ev.h"

#ifdef HAVE_TERMIOS_H
#include <termios.h>
Expand Down
17 changes: 16 additions & 1 deletion src/libutil/util.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2023 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef RSPAMD_UTIL_H
#define RSPAMD_UTIL_H

Expand All @@ -12,7 +28,6 @@
#include <netdb.h>
#endif

#include "contrib/libev/ev.h"
#include <time.h>

#ifdef __cplusplus
Expand Down

0 comments on commit ac2ee05

Please sign in to comment.