Changeset 637
- Timestamp:
- 01/22/07 23:18:28 (2 years ago)
- Files:
-
- cherokee/trunk/ChangeLog (modified) (1 diff)
- cherokee/trunk/cherokee/connection-protected.h (modified) (1 diff)
- cherokee/trunk/cherokee/connection.c (modified) (4 diffs)
- cherokee/trunk/cherokee/logger_writer.c (modified) (2 diffs)
- cherokee/trunk/cherokee/socket.c (modified) (3 diffs)
- cherokee/trunk/cherokee/thread.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/ChangeLog
r636 r637 1 2007-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 1 29 2007-01-22 Alvaro Lopez Ortega <alvaro@alobbs.com> 2 30 cherokee/trunk/cherokee/connection-protected.h
r597 r637 200 200 /* Close 201 201 */ 202 ret_t cherokee_connection_ pre_lingering_close(cherokee_connection_t *conn);202 ret_t cherokee_connection_shutdown_wr (cherokee_connection_t *conn); 203 203 ret_t cherokee_connection_linger_read (cherokee_connection_t *conn); 204 204 cherokee/trunk/cherokee/connection.c
r632 r637 327 327 cherokee_connection_mrproper (cherokee_connection_t *conn) 328 328 { 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 */ 331 333 conn->keepalive = 0; 332 334 333 335 /* Close and clean the socket 334 336 */ 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); 340 340 341 341 /* Clean the connection object … … 350 350 return ret_ok; 351 351 } 352 353 352 354 353 … … 826 825 827 826 ret_t 828 cherokee_connection_ pre_lingering_close(cherokee_connection_t *conn)827 cherokee_connection_shutdown_wr (cherokee_connection_t *conn) 829 828 { 830 829 /* At this point, we don't want to follow the TLS protocol … … 1900 1899 if (conn->logger_ref != NULL) { 1901 1900 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); 1905 1903 } else { 1906 1904 ret = cherokee_logger_write_access (conn->logger_ref, conn); cherokee/trunk/cherokee/logger_writer.c
r624 r637 30 30 #include <sys/types.h> 31 31 #include <sys/stat.h> 32 #include <stdlib.h> 33 #include <errno.h> 32 34 #include <fcntl.h> 33 35 … … 254 256 case cherokee_logger_writer_pipe: 255 257 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; 258 263 259 264 cherokee_buffer_move_to_begin (&writer->buffer, re); cherokee/trunk/cherokee/socket.c
r597 r637 908 908 case EINTR: 909 909 return ret_eagain; 910 910 911 case EPIPE: 912 #ifdef ENOTCONN 913 case ENOTCONN: 914 #endif 911 915 case ETIMEDOUT: 912 916 case ECONNRESET: 913 917 case EHOSTUNREACH: 914 918 socket->status = socket_closed; 915 return ret_e of;919 return ret_error; 916 920 } 917 921 … … 1013 1017 case EAGAIN: 1014 1018 return ret_eagain; 1019 1015 1020 case EBADF: 1016 1021 case EPIPE: 1017 1022 case ENOTSOCK: 1023 #ifdef ENOTCONN 1024 case ENOTCONN: 1025 #endif 1018 1026 case ETIMEDOUT: 1019 1027 case ECONNRESET: 1020 1028 case EHOSTUNREACH: 1021 1029 socket->status = socket_closed; 1022 return ret_e of;1030 return ret_error; 1023 1031 } 1024 1032 … … 1073 1081 case EINTR: 1074 1082 return ret_eagain; 1083 1075 1084 case EPIPE: 1085 #ifdef ENOTCONN 1086 case ENOTCONN: 1087 #endif 1076 1088 case ETIMEDOUT: 1077 1089 case ECONNRESET: 1078 1090 socket->status = socket_closed; 1079 return ret_e of;1080 } 1081 1091 return ret_error; 1092 } 1093 1082 1094 PRINT_ERROR ("ERROR: writev(%d, ..) -> errno=%d '%s'\n", 1083 1095 SOCKET_FD(socket), err, strerror(err)); cherokee/trunk/cherokee/thread.c
r597 r637 444 444 /* Shutdown writing, and try to read some trash 445 445 */ 446 ret = cherokee_connection_ pre_lingering_close(conn);446 ret = cherokee_connection_shutdown_wr (conn); 447 447 switch (ret) { 448 448 case ret_ok: … … 478 478 */ 479 479 if (conn->keepalive <= 0) { 480 ret = cherokee_connection_ pre_lingering_close(conn);480 ret = cherokee_connection_shutdown_wr (conn); 481 481 switch (ret) { 482 482 case ret_ok: … … 1218 1218 case phase_shutdown: 1219 1219 1220 ret = cherokee_connection_ pre_lingering_close(conn);1220 ret = cherokee_connection_shutdown_wr (conn); 1221 1221 switch (ret) { 1222 1222 case ret_ok: