Changeset 637

Show
Ignore:
Timestamp:
01/22/07 23:18:28 (2 years ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/ChangeLog

    r636 r637  
     12007-01-22  A.D.F  <adefacc@tin.it> 
     2 
     3        * cherokee/connection-protected.h: 
     4        - rename cherokee_connection_pre_lingering_close() 
     5              to cherokee_connection_shutdown_wr(); 
     6 
     7        * cherokee/connection.c: 
     8        - rename cherokee_connection_pre_lingering_close() 
     9              to cherokee_connection_shutdown_wr(); 
     10        - fix cherokee_connection_mrproper() 
     11          in order to always execute cleanup even if 
     12          one function fails. 
     13 
     14        * cherokee/thread.c: 
     15        - rename cherokee_connection_pre_lingering_close() 
     16              to cherokee_connection_shutdown_wr(); 
     17 
     18        * cherokee/socket.c: 
     19        - added ENOTCONN to the error codes which are not logged 
     20          (because they can happen under certain conditions); 
     21        - cherokee_socket_read(), cherokee_socket_write(), 
     22          cherokee_socket_writev(), now errors which are not 
     23          logged lead to ret_error instead of ret_eof. 
     24 
     25        * cherokee/logger_writer.c: 
     26        - added a loop around write() in order to retry write() 
     27          in case of EINTR error (signal interrupt). 
     28 
    1292007-01-22  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
    230 
  • cherokee/trunk/cherokee/connection-protected.h

    r597 r637  
    200200/* Close 
    201201 */ 
    202 ret_t cherokee_connection_pre_lingering_close    (cherokee_connection_t *conn); 
     202ret_t cherokee_connection_shutdown_wr            (cherokee_connection_t *conn); 
    203203ret_t cherokee_connection_linger_read            (cherokee_connection_t *conn); 
    204204 
  • cherokee/trunk/cherokee/connection.c

    r632 r637  
    327327cherokee_connection_mrproper (cherokee_connection_t *conn) 
    328328{ 
    329         ret_t ret; 
    330  
     329        /* Close and clean socket, objects, etc. 
     330         * IGNORING ERRORS in order to not leave things 
     331         * in an uncleaned / undetermined state. 
     332         */ 
    331333        conn->keepalive = 0; 
    332          
     334 
    333335        /* Close and clean the socket 
    334336         */ 
    335         ret = cherokee_socket_close (&conn->socket); 
    336         if (unlikely(ret < ret_ok)) return ret; 
    337  
    338         ret = cherokee_socket_clean (&conn->socket); 
    339         if (unlikely(ret < ret_ok)) return ret; 
     337        cherokee_socket_close (&conn->socket); 
     338 
     339        cherokee_socket_clean (&conn->socket); 
    340340 
    341341        /* Clean the connection object 
     
    350350        return ret_ok; 
    351351} 
    352  
    353352 
    354353 
     
    826825 
    827826ret_t  
    828 cherokee_connection_pre_lingering_close (cherokee_connection_t *conn) 
     827cherokee_connection_shutdown_wr (cherokee_connection_t *conn) 
    829828{ 
    830829        /* At this point, we don't want to follow the TLS protocol 
     
    19001899                if (conn->logger_ref != NULL) { 
    19011900                        if (http_type_400(conn->error_code) || 
    1902                             http_type_500(conn->error_code))  
    1903                         { 
    1904                                 ret = cherokee_logger_write_error (conn->logger_ref, conn);                              
     1901                            http_type_500(conn->error_code)) { 
     1902                                ret = cherokee_logger_write_error (conn->logger_ref, conn); 
    19051903                        } else { 
    19061904                                ret = cherokee_logger_write_access (conn->logger_ref, conn); 
  • cherokee/trunk/cherokee/logger_writer.c

    r624 r637  
    3030#include <sys/types.h> 
    3131#include <sys/stat.h> 
     32#include <stdlib.h> 
     33#include <errno.h> 
    3234#include <fcntl.h> 
    3335 
     
    254256        case cherokee_logger_writer_pipe: 
    255257        case cherokee_logger_writer_file: 
    256                 re = write (writer->fd, writer->buffer.buf, buflen); 
    257                 if (re < 0) return ret_error; 
     258                do { 
     259                        re = write (writer->fd, writer->buffer.buf, buflen); 
     260                } while (re == -1 && errno == EINTR); 
     261                if (re < 0) 
     262                        return ret_error; 
    258263 
    259264                cherokee_buffer_move_to_begin (&writer->buffer, re); 
  • cherokee/trunk/cherokee/socket.c

    r597 r637  
    908908                case EINTR:        
    909909                        return ret_eagain; 
     910 
    910911                case EPIPE:        
     912#ifdef ENOTCONN 
     913                case ENOTCONN: 
     914#endif 
    911915                case ETIMEDOUT: 
    912916                case ECONNRESET:   
    913917                case EHOSTUNREACH: 
    914918                        socket->status = socket_closed; 
    915                         return ret_eof
     919                        return ret_error
    916920                } 
    917921         
     
    10131017                case EAGAIN:     
    10141018                        return ret_eagain; 
     1019 
    10151020                case EBADF: 
    10161021                case EPIPE:  
    10171022                case ENOTSOCK: 
     1023#ifdef ENOTCONN 
     1024                case ENOTCONN: 
     1025#endif 
    10181026                case ETIMEDOUT: 
    10191027                case ECONNRESET: 
    10201028                case EHOSTUNREACH: 
    10211029                        socket->status = socket_closed; 
    1022                         return ret_eof
     1030                        return ret_error
    10231031                } 
    10241032 
     
    10731081                case EINTR:  
    10741082                        return ret_eagain; 
     1083 
    10751084                case EPIPE: 
     1085#ifdef ENOTCONN 
     1086                case ENOTCONN: 
     1087#endif 
    10761088                case ETIMEDOUT: 
    10771089                case ECONNRESET: 
    10781090                        socket->status = socket_closed; 
    1079                         return ret_eof
    1080                 } 
    1081                 
     1091                        return ret_error
     1092                } 
     1093 
    10821094                PRINT_ERROR ("ERROR: writev(%d, ..) -> errno=%d '%s'\n",  
    10831095                             SOCKET_FD(socket), err, strerror(err)); 
  • cherokee/trunk/cherokee/thread.c

    r597 r637  
    444444        /* Shutdown writing, and try to read some trash 
    445445         */ 
    446         ret = cherokee_connection_pre_lingering_close (conn); 
     446        ret = cherokee_connection_shutdown_wr (conn); 
    447447        switch (ret) { 
    448448        case ret_ok: 
     
    478478         */ 
    479479        if (conn->keepalive <= 0) { 
    480                 ret = cherokee_connection_pre_lingering_close (conn); 
     480                ret = cherokee_connection_shutdown_wr (conn); 
    481481                switch (ret) { 
    482482                case ret_ok: 
     
    12181218                case phase_shutdown:  
    12191219 
    1220                         ret = cherokee_connection_pre_lingering_close (conn); 
     1220                        ret = cherokee_connection_shutdown_wr (conn); 
    12211221                        switch (ret) { 
    12221222                        case ret_ok: