Changeset 6115:61d7ae76647d in nginx


Ignore:
Timestamp:
04/20/15 10:05:11 (9 years ago)
Author:
Ruslan Ermilov <ru@…>
Branch:
default
Phase:
public
Rebase:
39393530616530393933383861623865343833383961313066376166336161303233383361316633
Message:

Stream: port from NGINX+.

Files:
14 added
6 edited

Legend:

Unmodified
Added
Removed
  • auto/make

    r6065 r6115  
    1111         $NGX_OBJS/src/http/modules/perl \
    1212         $NGX_OBJS/src/mail \
     13         $NGX_OBJS/src/stream \
    1314         $NGX_OBJS/src/misc
    1415
     
    116117
    117118MAIL_INCS = $ngx_include_opt$ngx_incs
     119
     120END
     121
     122fi
     123
     124
     125# the stream dependences and include paths
     126
     127if [ $STREAM = YES ]; then
     128
     129    ngx_all_srcs="$ngx_all_srcs $STREAM_SRCS"
     130
     131    ngx_deps=`echo $STREAM_DEPS \
     132        | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
     133              -e "s/\//$ngx_regex_dirsep/g"`
     134
     135    ngx_incs=`echo $STREAM_INCS \
     136        | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
     137              -e "s/\//$ngx_regex_dirsep/g"`
     138
     139    cat << END                                                >> $NGX_MAKEFILE
     140
     141STREAM_DEPS = $ngx_deps
     142
     143
     144STREAM_INCS = $ngx_include_opt$ngx_incs
    118145
    119146END
     
    307334
    308335
    309 # the misc sources
    310 
    311 if test -n "$NGX_MISC_SRCS"; then
    312 
    313     ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
    314 
    315     for ngx_src in $NGX_MISC_SRCS
     336# the stream sources
     337
     338if [ $STREAM = YES ]; then
     339
     340    if test -n "$NGX_PCH"; then
     341        ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
     342    else
     343        ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(STREAM_INCS)"
     344    fi
     345
     346    for ngx_src in $STREAM_SRCS
    316347    do
    317348        ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
     
    324355        cat << END                                            >> $NGX_MAKEFILE
    325356
     357$ngx_obj:       \$(CORE_DEPS) \$(STREAM_DEPS)$ngx_cont$ngx_src
     358        $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
     359
     360END
     361     done
     362
     363fi
     364
     365
     366# the misc sources
     367
     368if test -n "$NGX_MISC_SRCS"; then
     369
     370    ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
     371
     372    for ngx_src in $NGX_MISC_SRCS
     373    do
     374        ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
     375        ngx_obj=`echo $ngx_src \
     376            | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
     377                  -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
     378                  -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
     379                  -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
     380
     381        cat << END                                            >> $NGX_MAKEFILE
     382
    326383$ngx_obj:       \$(CORE_DEPS) $ngx_cont$ngx_src
    327384        $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
  • auto/modules

    r6103 r6115  
    436436
    437437
     438if [ $STREAM_SSL = YES ]; then
     439    have=NGX_STREAM_SSL . auto/have
     440    USE_OPENSSL=YES
     441fi
     442
     443
    438444modules="$CORE_MODULES $EVENT_MODULES"
    439445
     
    506512
    507513
     514if [ $STREAM = YES ]; then
     515    have=NGX_STREAM . auto/have
     516    modules="$modules $STREAM_MODULES"
     517
     518    if [ $STREAM_SSL = YES ]; then
     519        modules="$modules $STREAM_SSL_MODULE"
     520        STREAM_DEPS="$STREAM_DEPS $STREAM_SSL_DEPS"
     521        STREAM_SRCS="$STREAM_SRCS $STREAM_SSL_SRCS"
     522    fi
     523
     524    if [ $STREAM_UPSTREAM_HASH = YES ]; then
     525        modules="$modules $STREAM_UPSTREAM_HASH_MODULE"
     526        STREAM_SRCS="$STREAM_SRCS $STREAM_UPSTREAM_HASH_SRCS"
     527    fi
     528
     529    if [ $STREAM_UPSTREAM_LEAST_CONN = YES ]; then
     530        modules="$modules $STREAM_UPSTREAM_LEAST_CONN_MODULE"
     531        STREAM_SRCS="$STREAM_SRCS $STREAM_UPSTREAM_LEAST_CONN_SRCS"
     532    fi
     533
     534    if [ $STREAM_UPSTREAM_ZONE = YES ]; then
     535        have=NGX_STREAM_UPSTREAM_ZONE . auto/have
     536        modules="$modules $STREAM_UPSTREAM_ZONE_MODULE"
     537        STREAM_SRCS="$STREAM_SRCS $STREAM_UPSTREAM_ZONE_SRCS"
     538    fi
     539
     540    NGX_ADDON_DEPS="$NGX_ADDON_DEPS \$(STREAM_DEPS)"
     541fi
     542
     543
    508544if [ $NGX_GOOGLE_PERFTOOLS = YES ]; then
    509545    modules="$modules $NGX_GOOGLE_PERFTOOLS_MODULE"
  • auto/options

    r6103 r6115  
    115115MAIL_SMTP=YES
    116116
     117STREAM=NO
     118STREAM_SSL=NO
     119STREAM_UPSTREAM_HASH=YES
     120STREAM_UPSTREAM_LEAST_CONN=YES
     121STREAM_UPSTREAM_ZONE=YES
     122
    117123NGX_ADDONS=
    118124
     
    276282        --without-mail_smtp_module)      MAIL_SMTP=NO               ;;
    277283
     284        --with-stream)                   STREAM=YES                 ;;
     285        --with-stream_ssl_module)        STREAM_SSL=YES             ;;
     286        --without-stream_upstream_hash_module)
     287                                         STREAM_UPSTREAM_HASH=NO    ;;
     288        --without-stream_upstream_least_conn_module)
     289                                         STREAM_UPSTREAM_LEAST_CONN=NO ;;
     290        --without-stream_upstream_zone_module)
     291                                         STREAM_UPSTREAM_ZONE=NO    ;;
     292
    278293        --with-google_perftools_module)  NGX_GOOGLE_PERFTOOLS=YES   ;;
    279294        --with-cpp_test_module)          NGX_CPP_TEST=YES           ;;
     
    437452  --without-mail_smtp_module         disable ngx_mail_smtp_module
    438453
     454  --with-stream                      enable TCP proxy module
     455  --with-stream_ssl_module           enable ngx_stream_ssl_module
     456  --without-stream_upstream_hash_module
     457                                     disable ngx_stream_upstream_hash_module
     458  --without-stream_upstream_least_conn_module
     459                                     disable ngx_stream_upstream_least_conn_module
     460  --without-stream_upstream_zone_module
     461                                     disable ngx_stream_upstream_zone_module
     462
    439463  --with-google_perftools_module     enable ngx_google_perftools_module
    440464  --with-cpp_test_module             enable ngx_cpp_test_module
  • auto/sources

    r6103 r6115  
    555555MAIL_PROXY_SRCS="src/mail/ngx_mail_proxy_module.c"
    556556
     557
     558STREAM_INCS="src/stream"
     559
     560STREAM_DEPS="src/stream/ngx_stream.h \
     561             src/stream/ngx_stream_upstream.h \
     562             src/stream/ngx_stream_upstream_round_robin.h"
     563
     564STREAM_MODULES="ngx_stream_module \
     565                ngx_stream_core_module \
     566                ngx_stream_proxy_module \
     567                ngx_stream_upstream_module"
     568
     569STREAM_SRCS="src/stream/ngx_stream.c \
     570             src/stream/ngx_stream_handler.c \
     571             src/stream/ngx_stream_core_module.c \
     572             src/stream/ngx_stream_proxy_module.c \
     573             src/stream/ngx_stream_upstream.c \
     574             src/stream/ngx_stream_upstream_round_robin.c"
     575
     576STREAM_SSL_MODULE="ngx_stream_ssl_module"
     577STREAM_SSL_DEPS="src/stream/ngx_stream_ssl_module.h"
     578STREAM_SSL_SRCS="src/stream/ngx_stream_ssl_module.c"
     579
     580STREAM_UPSTREAM_HASH_MODULE=ngx_stream_upstream_hash_module
     581STREAM_UPSTREAM_HASH_SRCS=src/stream/ngx_stream_upstream_hash_module.c
     582
     583STREAM_UPSTREAM_LEAST_CONN_MODULE=ngx_stream_upstream_least_conn_module
     584STREAM_UPSTREAM_LEAST_CONN_SRCS=" \
     585    src/stream/ngx_stream_upstream_least_conn_module.c"
     586
     587STREAM_UPSTREAM_ZONE_MODULE=ngx_stream_upstream_zone_module
     588STREAM_UPSTREAM_ZONE_SRCS=src/stream/ngx_stream_upstream_zone_module.c
     589
     590
    557591NGX_GOOGLE_PERFTOOLS_MODULE=ngx_google_perftools_module
    558592NGX_GOOGLE_PERFTOOLS_SRCS=src/misc/ngx_google_perftools_module.c
  • src/core/ngx_log.c

    r6033 r6115  
    8787static const char *debug_levels[] = {
    8888    "debug_core", "debug_alloc", "debug_mutex", "debug_event",
    89     "debug_http", "debug_mail", "debug_mysql"
     89    "debug_http", "debug_mail", "debug_mysql", "debug_stream"
    9090};
    9191
  • src/core/ngx_log.h

    r5962 r6115  
    3131#define NGX_LOG_DEBUG_MAIL        0x200
    3232#define NGX_LOG_DEBUG_MYSQL       0x400
     33#define NGX_LOG_DEBUG_STREAM      0x800
    3334
    3435/*
     
    3839
    3940#define NGX_LOG_DEBUG_FIRST       NGX_LOG_DEBUG_CORE
    40 #define NGX_LOG_DEBUG_LAST        NGX_LOG_DEBUG_MYSQL
     41#define NGX_LOG_DEBUG_LAST        NGX_LOG_DEBUG_STREAM
    4142#define NGX_LOG_DEBUG_CONNECTION  0x80000000
    4243#define NGX_LOG_DEBUG_ALL         0x7ffffff0
Note: See TracChangeset for help on using the changeset viewer.