nginx/src/event/ngx_event_connect.h

62 lines
1.2 KiB
C
Raw Normal View History

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 {
2003-11-26 04:44:56 +08:00
in_addr_t addr;
2003-05-12 23:52:24 +08:00
ngx_str_t host;
int port;
2003-07-23 03:53:10 +08:00
ngx_str_t addr_port_text;
2003-05-12 23:52:24 +08:00
int fails;
time_t accessed;
} ngx_peer_t;
typedef struct {
2003-10-02 13:39:37 +08:00
int current;
int number;
int max_fails;
int fail_timeout;
int 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
2003-10-02 13:39:37 +08:00
ngx_peer_t peers[1];
2003-05-12 23:52:24 +08:00
} ngx_peers_t;
typedef struct {
ngx_peers_t *peers;
int cur_peer;
int tries;
2003-07-21 05:15:59 +08:00
2003-07-22 00:24:25 +08:00
ngx_connection_t *connection;
2004-07-05 23:08:23 +08:00
#if (NGX_THREADS)
ngx_atomic_t *lock;
#endif
2003-07-22 00:24:25 +08:00
2003-07-23 03:53:10 +08:00
int rcvbuf;
2003-08-01 22:56:33 +08:00
ngx_log_t *log;
2003-07-21 05:15:59 +08:00
unsigned cached:1;
2004-03-15 04:46:25 +08:00
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
2003-10-02 13:39:37 +08:00
int ngx_event_connect_peer(ngx_peer_connection_t *pc);
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_ */