~ubuntu-branches/ubuntu/quantal/nginx/quantal-updates

« back to all changes in this revision

Viewing changes to src/event/ngx_event_accept.c

  • Committer: Bazaar Package Importer
  • Author(s): Kartik Mistry
  • Date: 2011-04-16 13:47:58 UTC
  • mfrom: (4.2.31 sid)
  • Revision ID: james.westby@ubuntu.com-20110416134758-yqca2qp5crh2hw2f
Tags: 1.0.0-2
* debian/rules:
  + Removed --with-file-aio support. Fixed FTBFS on kFreeBSD-* arch
    (Closes: #621882)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    ngx_connection_t  *c, *lc;
27
27
    ngx_event_conf_t  *ecf;
28
28
    u_char             sa[NGX_SOCKADDRLEN];
 
29
#if (NGX_HAVE_ACCEPT4)
 
30
    static ngx_uint_t  use_accept4 = 1;
 
31
#endif
29
32
 
30
33
    ecf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_event_core_module);
31
34
 
46
49
    do {
47
50
        socklen = NGX_SOCKADDRLEN;
48
51
 
 
52
#if (NGX_HAVE_ACCEPT4)
 
53
        if (use_accept4) {
 
54
            s = accept4(lc->fd, (struct sockaddr *) sa, &socklen,
 
55
                        SOCK_NONBLOCK);
 
56
        } else {
 
57
            s = accept(lc->fd, (struct sockaddr *) sa, &socklen);
 
58
        }
 
59
#else
49
60
        s = accept(lc->fd, (struct sockaddr *) sa, &socklen);
 
61
#endif
50
62
 
51
63
        if (s == -1) {
52
64
            err = ngx_socket_errno;
57
69
                return;
58
70
            }
59
71
 
 
72
#if (NGX_HAVE_ACCEPT4)
 
73
            ngx_log_error((ngx_uint_t) ((err == NGX_ECONNABORTED) ?
 
74
                                             NGX_LOG_ERR : NGX_LOG_ALERT),
 
75
                          ev->log, err,
 
76
                          use_accept4 ? "accept4() failed" : "accept() failed");
 
77
 
 
78
            if (use_accept4 && err == NGX_ENOSYS) {
 
79
                use_accept4 = 0;
 
80
                ngx_inherited_nonblocking = 0;
 
81
                continue;
 
82
            }
 
83
#else
60
84
            ngx_log_error((ngx_uint_t) ((err == NGX_ECONNABORTED) ?
61
85
                                             NGX_LOG_ERR : NGX_LOG_ALERT),
62
86
                          ev->log, err, "accept() failed");
 
87
#endif
63
88
 
64
89
            if (err == NGX_ECONNABORTED) {
65
90
                if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {