Changeset 1692
- Timestamp:
- 07/25/08 16:43:48 (6 months ago)
- Files:
-
- cherokee/trunk/ChangeLog (modified) (1 diff)
- cherokee/trunk/acinclude.m4 (modified) (1 diff)
- cherokee/trunk/cherokee/connection.c (modified) (1 diff)
- cherokee/trunk/cherokee/socket.c (modified) (2 diffs)
- cherokee/trunk/cherokee/socket.h (modified) (1 diff)
- cherokee/trunk/configure.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/ChangeLog
r1691 r1692 1 1 2008-07-25 Alvaro Lopez Ortega <alvaro@alobbs.com> 2 3 * cherokee/socket.c, cherokee/socket.h, cherokee/connection.c, 4 configure.in, acinclude.m4: Added support for TCP_CORK on BSD and 5 OS X systems. Actually, it's called TCP_NOPUSH on those. 2 6 3 7 * admin/config.py (Config.serialize): Sorts the configuration file cherokee/trunk/acinclude.m4
r1 r1692 448 448 449 449 ]) 450 451 AC_DEFUN([HYDRA_TCP_NOPUSH], [ 452 453 AC_MSG_CHECKING([whether TCP_NOPUSH is a valid TCP socket option]) 454 AC_TRY_COMPILE( 455 #include <sys/socket.h> 456 #include <netinet/tcp.h> 457 #include <netinet/in.h> 458 ,[ 459 int one = 1, fd; 460 if (setsockopt(fd, IPPROTO_TCP, TCP_NOPUSH, 461 (void *) &one, sizeof (one)) == -1) 462 return -1; 463 return 0; 464 465 ], 466 dnl *** FOUND 467 AC_DEFINE( HAVE_TCP_NOPUSH, 1, [TCP_NOPUSH was found and will be used]) 468 AC_MSG_RESULT(yes), 469 dnl *** NOT FOUND 470 AC_MSG_RESULT(no) 471 ) 472 473 ]) cherokee/trunk/cherokee/connection.c
r1684 r1692 721 721 cherokee_connection_set_cork (cherokee_connection_t *conn, cherokee_boolean_t enable) 722 722 { 723 #ifdef HAVE_TCP_CORK 724 int fd; 725 int on = 0; 726 727 fd = SOCKET_FD(&conn->socket); 728 if (enable) { 729 setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on); 730 731 on = 1; 732 setsockopt(fd, IPPROTO_TCP, TCP_CORK, &on, sizeof on); 723 cherokee_socket_set_cork (&conn->socket, enable); 724 725 if (enable) 733 726 BIT_SET (conn->options, conn_op_tcp_cork); 734 } else { 735 setsockopt(fd, IPPROTO_TCP, TCP_CORK, &on, sizeof on); 736 737 on = 1; 738 setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on); 727 else 739 728 BIT_UNSET (conn->options, conn_op_tcp_cork); 740 }741 #else742 UNUSED(conn);743 UNUSED(enable);744 #endif745 729 746 730 return ret_ok; cherokee/trunk/cherokee/socket.c
r1575 r1692 84 84 #endif 85 85 86 #if !defined(TCP_CORK) && defined(TCP_NOPUSH) 87 #define TCP_CORK TCP_NOPUSH 88 #endif 89 86 90 #define ENTRIES "socket" 87 91 … … 1886 1890 } 1887 1891 1892 1893 ret_t 1894 cherokee_socket_set_cork (cherokee_socket_t *socket, cherokee_boolean_t *enable) 1895 { 1896 #if defined(HAVE_TCP_CORK) || defined(HAVE_TCP_NOPUSH) 1897 int on; 1898 int fd = socket->socket; 1899 1900 if (enable) { 1901 on = 0; 1902 setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on); 1903 on = 1; 1904 setsockopt(fd, IPPROTO_TCP, TCP_CORK, &on, sizeof on); 1905 } else { 1906 on = 0; 1907 setsockopt(fd, IPPROTO_TCP, TCP_CORK, &on, sizeof on); 1908 on = 1; 1909 setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on); 1910 } 1911 #else 1912 UNUSED(socket); 1913 UNUSED(enable); 1914 #endif 1915 return ret_ok; 1916 } cherokee/trunk/cherokee/socket.h
r1131 r1692 204 204 ret_t cherokee_socket_gethostbyname (cherokee_socket_t *socket, cherokee_buffer_t *hostname); 205 205 ret_t cherokee_socket_set_status (cherokee_socket_t *socket, cherokee_socket_status_t status); 206 ret_t cherokee_socket_set_cork (cherokee_socket_t *socket, cherokee_boolean_t *enable); 206 207 207 208 /* Low level functions cherokee/trunk/configure.in
r1651 r1692 451 451 dnl 452 452 HYDRA_TCP_CORK 453 HYDRA_TCP_NOPUSH 453 454 454 455 dnl