~britco/nginx/master

« back to all changes in this revision

Viewing changes to src/event/ngx_event_connect.c

  • Committer: Bazaar Package Importer
  • Author(s): Kartik Mistry, Kartik Mistry, Michael Lustfield
  • Date: 2010-11-27 21:04:02 UTC
  • mfrom: (1.3.8 upstream)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: james.westby@ubuntu.com-20101127210402-14sgjpe6r3jup8a9
Tags: 0.8.53-1
[Kartik Mistry]
* debian/control:
  + Added Michael Lustfield as co-maintainer
* nginx.conf:
  + No need to use regex in gzip_disable for msie6, Thanks to António P. P.
    Almeida <appa@perusio.net> (Closes: #592147)
* conf/sites-available/default:
  + Fixed typo for "include fastcgi", Thanks to Mostafa Ghadamyari
    <nginx@gigfa.com> (Closes: #593142, #593143)
* debian/patches/fix_reloading_ipv6.diff:
  + Removed, merged upstream
* debian/init.d:
  + Added fix to control nginx by user in a simple way by setting DAEMON
    variable to an invalid name in /etc/default/nginx. Patch by Toni Mueller
    <support@oeko.net> (Closes: #594598)
* debian/NEWS.Debian:
  + Updated news for 0.8.x as stable branch

[Michael Lustfield]
* New upstream release (Closes: #602970)
  + 0.8.x branch is declared stable by upstream now
* Add a UFW profile set:
  + debian/nginx.ufw.profile: Added.
  + debian/control: nginx: Suggests ufw.
  + debian/dirs: Add 'etc/ufw/applications.d'
  + debian/rules: Add install rule for the nginx UFW profile.
* Moved debian/dirs to debian/nginx.dirs
* Added types_hash_max_size to nginx.conf
* Install simple default index.html file (Closes: #581416)
  + debian/dirs: Add 'usr/share/nginx/www'.
  + debian/nginx.install: Add 'html/* usr/share/nginx/www'.
* debian/patches/nginx-echo.diff:
  + Added Echo module
* Added files for nginx.docs
  - /usr/share/doc/nginx/
    + debian/help/docs/fcgiwrap
    + debian/help/docs/php
    + debian/help/docs/support-irc
    + debian/help/docs/upstream
* Added files for nginx.examples
  - /usr/share/doc/nginx/examples/
    + debian/help/docs/drupal
    + debian/help/docs/http
    + debian/help/docs/mail
    + debian/help/docs/mailman
    + debian/help/docs/nginx.conf
    + debian/help/docs/virtual_hosts
    + debian/help/docs/wordpress
* debian/conf/:
  + Removed excess spaces
  + Added tabs where appropriate
  + Added SCRIPT_FILENAME to fastcgi_params

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
        {
55
55
            ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
56
56
                          "setsockopt(SO_RCVBUF) failed");
57
 
 
58
 
            ngx_free_connection(c);
59
 
 
60
 
            if (ngx_close_socket(s) == -1) {
61
 
                ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
62
 
                              ngx_close_socket_n " failed");
63
 
            }
64
 
 
65
 
            return NGX_ERROR;
 
57
            goto failed;
66
58
        }
67
59
    }
68
60
 
70
62
        ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
71
63
                      ngx_nonblocking_n " failed");
72
64
 
73
 
        ngx_free_connection(c);
74
 
 
75
 
        if (ngx_close_socket(s) == -1) {
76
 
            ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
77
 
                          ngx_close_socket_n " failed");
 
65
        goto failed;
 
66
    }
 
67
 
 
68
    if (pc->local) {
 
69
        if (bind(s, pc->local->sockaddr, pc->local->socklen) == -1) {
 
70
            ngx_log_error(NGX_LOG_CRIT, pc->log, ngx_socket_errno,
 
71
                          "bind(%V) failed", &pc->local->name);
 
72
 
 
73
            goto failed;
78
74
        }
79
 
 
80
 
        return NGX_ERROR;
81
75
    }
82
76
 
83
77
    c->recv = ngx_recv;
107
101
 
108
102
    pc->connection = c;
109
103
 
110
 
    /*
111
 
     * TODO: MT: - ngx_atomic_fetch_add()
112
 
     *             or protection by critical section or mutex
113
 
     *
114
 
     * TODO: MP: - allocated in a shared memory
115
 
     *           - ngx_atomic_fetch_add()
116
 
     *             or protection by critical section or mutex
117
 
     */
118
 
 
119
104
    c->number = ngx_atomic_fetch_add(ngx_connection_counter, 1);
120
105
 
121
106
#if (NGX_THREADS)
 
107
 
 
108
    /* TODO: lock event when call completion handler */
 
109
 
122
110
    rev->lock = pc->lock;
123
111
    wev->lock = pc->lock;
124
112
    rev->own_lock = &c->lock;
125
113
    wev->own_lock = &c->lock;
 
114
 
126
115
#endif
127
116
 
128
117
    if (ngx_add_conn) {
129
118
        if (ngx_add_conn(c) == NGX_ERROR) {
130
 
            return NGX_ERROR;
 
119
            goto failed;
131
120
        }
132
121
    }
133
122
 
199
188
        if (ngx_blocking(s) == -1) {
200
189
            ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
201
190
                          ngx_blocking_n " failed");
202
 
            return NGX_ERROR;
 
191
            goto failed;
203
192
        }
204
193
 
205
194
        /*
229
218
    }
230
219
 
231
220
    if (ngx_add_event(rev, NGX_READ_EVENT, event) != NGX_OK) {
232
 
        return NGX_ERROR;
 
221
        goto failed;
233
222
    }
234
223
 
235
224
    if (rc == -1) {
237
226
        /* NGX_EINPROGRESS */
238
227
 
239
228
        if (ngx_add_event(wev, NGX_WRITE_EVENT, event) != NGX_OK) {
240
 
            return NGX_ERROR;
 
229
            goto failed;
241
230
        }
242
231
 
243
232
        return NGX_AGAIN;
248
237
    wev->ready = 1;
249
238
 
250
239
    return NGX_OK;
 
240
 
 
241
failed:
 
242
 
 
243
    ngx_free_connection(c);
 
244
 
 
245
    if (ngx_close_socket(s) == -1) {
 
246
        ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
 
247
                      ngx_close_socket_n " failed");
 
248
    }
 
249
 
 
250
    return NGX_ERROR;
251
251
}
252
252
 
253
253