nginx/src/event/ngx_event_connect.h

74 lines
1.4 KiB
C
Raw Normal View History

/*
* Copyright (C) Igor Sysoev
*/
2003-05-12 23:52:24 +08:00
#ifndef _NGX_EVENT_CONNECT_H_INCLUDED_
#define _NGX_EVENT_CONNECT_H_INCLUDED_
#include <ngx_config.h>
2003-07-21 05:15:59 +08:00
#include <ngx_core.h>
2003-05-12 23:52:24 +08:00
#include <ngx_event.h>
2003-10-02 13:39:37 +08:00
#define NGX_CONNECT_ERROR -10
2003-05-12 23:52:24 +08:00
typedef struct {
struct sockaddr *sockaddr;
socklen_t socklen;
2003-05-12 23:52:24 +08:00
ngx_str_t name;
char *uri_separator;
2003-05-12 23:52:24 +08:00
ngx_uint_t weight;
2003-05-12 23:52:24 +08:00
ngx_uint_t fails;
time_t accessed;
ngx_uint_t max_fails;
time_t fail_timeout;
} ngx_peer_t;
struct ngx_peers_s {
ngx_uint_t current;
ngx_uint_t weight;
ngx_uint_t number;
ngx_uint_t last_cached;
2003-05-12 23:52:24 +08:00
2003-10-02 13:39:37 +08:00
/* ngx_mutex_t *mutex; */
ngx_connection_t **cached;
2003-05-12 23:52:24 +08:00
ngx_peer_t peer[1];
};
2003-05-12 23:52:24 +08:00
typedef struct {
ngx_peers_t *peers;
ngx_uint_t cur_peer;
ngx_uint_t tries;
2003-07-21 05:15:59 +08:00
ngx_connection_t *connection;
2004-07-05 23:08:23 +08:00
#if (NGX_THREADS)
ngx_atomic_t *lock;
2004-07-05 23:08:23 +08:00
#endif
2003-07-22 00:24:25 +08:00
int rcvbuf;
2003-07-23 03:53:10 +08:00
ngx_log_t *log;
2003-08-01 22:56:33 +08:00
unsigned cached:1;
unsigned log_error:2; /* ngx_connection_log_error_e */
2003-07-22 00:24:25 +08:00
} ngx_peer_connection_t;
2003-05-12 23:52:24 +08:00
ngx_int_t ngx_event_connect_peer(ngx_peer_connection_t *pc);
2003-10-02 13:39:37 +08:00
void ngx_event_connect_peer_failed(ngx_peer_connection_t *pc);
2003-05-12 23:52:24 +08:00
#endif /* _NGX_EVENT_CONNECT_H_INCLUDED_ */