upstream: Add upstream list parameter to upstream_get()
to abstract it from the concrete list in the config struct. Now upstream.c does not use any reference to config any more. Michael
This commit is contained in:
parent
22fba83df2
commit
4a8ea0d23b
@ -58,7 +58,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifdef UPSTREAM_SUPPORT
|
#ifdef UPSTREAM_SUPPORT
|
||||||
# define UPSTREAM_CONFIGURED() (config.upstream_list != NULL)
|
# define UPSTREAM_CONFIGURED() (config.upstream_list != NULL)
|
||||||
# define UPSTREAM_HOST(host) upstream_get(host)
|
# define UPSTREAM_HOST(host) upstream_get(host, config.upstream_list)
|
||||||
#else
|
#else
|
||||||
# define UPSTREAM_CONFIGURED() (0)
|
# define UPSTREAM_CONFIGURED() (0)
|
||||||
# define UPSTREAM_HOST(host) (NULL)
|
# define UPSTREAM_HOST(host) (NULL)
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#include "upstream.h"
|
#include "upstream.h"
|
||||||
#include "heap.h"
|
#include "heap.h"
|
||||||
#include "main.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
#ifdef UPSTREAM_SUPPORT
|
#ifdef UPSTREAM_SUPPORT
|
||||||
@ -165,10 +164,8 @@ upstream_cleanup:
|
|||||||
/*
|
/*
|
||||||
* Check if a host is in the upstream list
|
* Check if a host is in the upstream list
|
||||||
*/
|
*/
|
||||||
struct upstream *upstream_get (char *host)
|
struct upstream *upstream_get (char *host, struct upstream *up)
|
||||||
{
|
{
|
||||||
struct upstream *up = config.upstream_list;
|
|
||||||
|
|
||||||
in_addr_t my_ip = INADDR_NONE;
|
in_addr_t my_ip = INADDR_NONE;
|
||||||
|
|
||||||
while (up) {
|
while (up) {
|
||||||
|
@ -42,7 +42,7 @@ struct upstream {
|
|||||||
#ifdef UPSTREAM_SUPPORT
|
#ifdef UPSTREAM_SUPPORT
|
||||||
extern void upstream_add (const char *host, int port, const char *domain,
|
extern void upstream_add (const char *host, int port, const char *domain,
|
||||||
struct upstream **upstream_list);
|
struct upstream **upstream_list);
|
||||||
struct upstream *upstream_get (char *host);
|
extern struct upstream *upstream_get (char *host, struct upstream *up);
|
||||||
#endif /* UPSTREAM_SUPPORT */
|
#endif /* UPSTREAM_SUPPORT */
|
||||||
|
|
||||||
#endif /* _TINYPROXY_UPSTREAM_H_ */
|
#endif /* _TINYPROXY_UPSTREAM_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user