Permalink
Browse files

fix coding style

  • Loading branch information...
1 parent e153eb4 commit 03bcb3cdf02df506d42f753fd7ca75743aef65f5 @yaoweibin committed Jul 5, 2012
@@ -21,26 +21,28 @@ typedef struct ngx_tcp_proxy_conf_s {
static void ngx_tcp_proxy_init_session(ngx_tcp_session_t *s);
static void ngx_tcp_proxy_init_upstream(ngx_connection_t *c,
- ngx_tcp_session_t *s);
+ ngx_tcp_session_t *s);
static void ngx_tcp_upstream_init_proxy_handler(ngx_tcp_session_t *s,
- ngx_tcp_upstream_t *u);
+ ngx_tcp_upstream_t *u);
static char *ngx_tcp_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static void ngx_tcp_proxy_dummy_read_handler(ngx_event_t *ev);
static void ngx_tcp_proxy_dummy_write_handler(ngx_event_t *ev);
static void ngx_tcp_proxy_handler(ngx_event_t *ev);
static void *ngx_tcp_proxy_create_conf(ngx_conf_t *cf);
static char *ngx_tcp_proxy_merge_conf(ngx_conf_t *cf, void *parent,
- void *child);
+ void *child);
static ngx_tcp_protocol_t ngx_tcp_generic_protocol = {
+
ngx_string("tcp_generic"),
{ 0, 0, 0, 0 },
NGX_TCP_GENERIC_PROTOCOL,
ngx_tcp_proxy_init_session,
NULL,
NULL,
ngx_string("500 Internal server error" CRLF)
+
};
@@ -183,7 +185,7 @@ ngx_tcp_proxy_dummy_read_handler(ngx_event_t *rev)
static void
-ngx_tcp_proxy_init_upstream(ngx_connection_t *c, ngx_tcp_session_t *s)
+ngx_tcp_proxy_init_upstream(ngx_connection_t *c, ngx_tcp_session_t *s)
{
ngx_tcp_upstream_t *u;
ngx_tcp_proxy_ctx_t *p;
@@ -232,7 +234,7 @@ ngx_tcp_proxy_init_upstream(ngx_connection_t *c, ngx_tcp_session_t *s)
static void
-ngx_tcp_upstream_init_proxy_handler(ngx_tcp_session_t *s, ngx_tcp_upstream_t *u)
+ngx_tcp_upstream_init_proxy_handler(ngx_tcp_session_t *s, ngx_tcp_upstream_t *u)
{
ngx_connection_t *c;
ngx_tcp_proxy_ctx_t *pctx;
@@ -241,7 +243,8 @@ ngx_tcp_upstream_init_proxy_handler(ngx_tcp_session_t *s, ngx_tcp_upstream_t *u)
c = s->connection;
c->log->action = "ngx_tcp_upstream_init_proxy_handler";
- ngx_log_debug0(NGX_LOG_DEBUG_TCP, s->connection->log, 0, "tcp proxy upstream init proxy");
+ ngx_log_debug0(NGX_LOG_DEBUG_TCP, s->connection->log, 0,
+ "tcp proxy upstream init proxy");
pcf = ngx_tcp_get_module_srv_conf(s, ngx_tcp_proxy_module);
@@ -281,8 +284,10 @@ ngx_tcp_upstream_init_proxy_handler(ngx_tcp_session_t *s, ngx_tcp_upstream_t *u)
#if (NGX_TCP_SSL)
- /* The ssl connection with client may not trigger the read event again,
- * So I trigger it in this function. */
+ /*
+ * The ssl connection with client may not trigger the read event again,
+ * So I trigger it in this function.
+ * */
if (s->connection->ssl) {
ngx_tcp_proxy_handler(s->connection->read);
}
@@ -381,8 +386,8 @@ ngx_tcp_proxy_handler(ngx_event_t *ev)
#endif
ngx_log_debug4(NGX_LOG_DEBUG_TCP, ev->log, 0,
- "tcp proxy handler: %d, #%d > #%d, time:%ui",
- do_write, src->fd, dst->fd, ngx_current_msec);
+ "tcp proxy handler: %d, #%d > #%d, time:%ui",
+ do_write, src->fd, dst->fd, ngx_current_msec);
for ( ;; ) {
@@ -396,7 +401,8 @@ ngx_tcp_proxy_handler(ngx_event_t *ev)
n = dst->send(dst, b->pos, size);
err = ngx_socket_errno;
- ngx_log_debug1(NGX_LOG_DEBUG_TCP, ev->log, 0, "tcp proxy handler send:%d", n);
+ ngx_log_debug1(NGX_LOG_DEBUG_TCP, ev->log, 0,
+ "tcp proxy handler send:%d", n);
if (n == NGX_ERROR) {
ngx_log_error(NGX_LOG_ERR, c->log, err, "proxy send error");
@@ -524,8 +530,11 @@ ngx_tcp_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ngx_tcp_core_srv_conf_t *cscf;
cscf = ngx_tcp_conf_get_module_srv_conf(cf, ngx_tcp_core_module);
+
if (cscf->protocol && ngx_strncmp(cscf->protocol->name.data,
- (u_char *)"tcp_generic", sizeof("tcp_generic") - 1) != 0) {
+ (u_char *)"tcp_generic",
+ sizeof("tcp_generic") - 1) != 0) {
+
return "the protocol should be tcp_generic";
}
@@ -245,11 +245,11 @@ ngx_tcp_ssl_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
#if defined(nginx_version) && nginx_version >= 1000006
ngx_conf_merge_str_value(conf->ecdh_curve, prev->ecdh_curve,
- NGX_DEFAULT_ECDH_CURVE);
+ NGX_DEFAULT_ECDH_CURVE);
#endif
ngx_conf_merge_str_value(conf->client_certificate, prev->client_certificate,
- "");
+ "");
ngx_conf_merge_str_value(conf->crl, prev->crl, "");
ngx_conf_merge_str_value(conf->ciphers, prev->ciphers, NGX_DEFAULT_CIPHERS);
@@ -6,7 +6,7 @@
typedef struct {
/* the round robin data must be first */
- ngx_tcp_upstream_rr_peer_data_t rrp;
+ ngx_tcp_upstream_rr_peer_data_t rrp;
u_char tries;
@@ -142,10 +142,11 @@ ngx_tcp_upstream_get_busyness_peer(ngx_peer_connection_t *pc, void *data)
/* TODO: cached */
if (bp->tries > 20 || bp->rrp.peers->single ||
- bp->rrp.peers->peer[0].check_index == (ngx_uint_t) NGX_INVALID_CHECK_INDEX) {
+ bp->rrp.peers->peer[0].check_index
+ == (ngx_uint_t) NGX_INVALID_CHECK_INDEX) {
ngx_log_debug1(NGX_LOG_DEBUG_TCP, pc->log, 0,
- "get busyness peer0, bp->tries: %ui", bp->tries);
+ "get busyness peer0, bp->tries: %ui", bp->tries);
return bp->get_rr_peer(pc, &bp->rrp);
}
@@ -166,7 +167,8 @@ ngx_tcp_upstream_get_busyness_peer(ngx_peer_connection_t *pc, void *data)
peer = &bp->rrp.peers->peer[p];
ngx_log_debug4(NGX_LOG_DEBUG_TCP, pc->log, 0,
- "get busyness peer, check_index: %ui, %ui, %04XA, num: %d",
+ "get busyness peer, check_index: %ui, %ui, "
+ "%04XA, num: %d",
peer->check_index, p, m, bp->rrp.peers->number);
/* ngx_lock_mutex(bp->rrp.peers->mutex); */
@@ -191,7 +193,8 @@ ngx_tcp_upstream_get_busyness_peer(ngx_peer_connection_t *pc, void *data)
}
ngx_log_debug2(NGX_LOG_DEBUG_TCP, pc->log, 0,
- "get busyness peer, bp->tries: %ui, p: %ui", bp->tries, p);
+ "get busyness peer, bp->tries: %ui, p: %ui",
+ bp->tries, p);
if (++bp->tries >= 20) {
return bp->get_rr_peer(pc, &bp->rrp);
@@ -6,7 +6,7 @@
typedef struct {
/* the round robin data must be first */
- ngx_tcp_upstream_rr_peer_data_t rrp;
+ ngx_tcp_upstream_rr_peer_data_t rrp;
ngx_uint_t hash;
@@ -52,9 +52,9 @@ static ngx_tcp_module_t ngx_tcp_upstream_ip_hash_module_ctx = {
ngx_module_t ngx_tcp_upstream_ip_hash_module = {
NGX_MODULE_V1,
- &ngx_tcp_upstream_ip_hash_module_ctx, /* module context */
- ngx_tcp_upstream_ip_hash_commands, /* module directives */
- NGX_TCP_MODULE, /* module type */
+ &ngx_tcp_upstream_ip_hash_module_ctx, /* module context */
+ ngx_tcp_upstream_ip_hash_commands, /* module directives */
+ NGX_TCP_MODULE, /* module type */
NULL, /* init master */
NULL, /* init module */
NULL, /* init process */
@@ -85,7 +85,7 @@ ngx_tcp_upstream_init_ip_hash_peer(ngx_tcp_session_t *s,
{
u_char *p;
struct sockaddr_in *sin;
- ngx_tcp_upstream_ip_hash_peer_data_t *iphp;
+ ngx_tcp_upstream_ip_hash_peer_data_t *iphp;
iphp = ngx_palloc(s->pool, sizeof(ngx_tcp_upstream_ip_hash_peer_data_t));
if (iphp == NULL) {
Oops, something went wrong.

0 comments on commit 03bcb3c

Please sign in to comment.