Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-06-04 21:28:33 +0400
committerIgor Sysoev <igor@sysoev.ru>2003-06-04 21:28:33 +0400
commit9cf783074fd7793ebb6859e7f62b054d79074efe (patch)
treeb5bd9726d10952b0fab24754e2af210a9b644682 /src/os/unix/ngx_socket.c
parent1c10462e88491d52a23e22fbc3ca0012591df095 (diff)
nginx-0.0.1-2003-06-04-21:28:33 import
Diffstat (limited to 'src/os/unix/ngx_socket.c')
-rw-r--r--src/os/unix/ngx_socket.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/src/os/unix/ngx_socket.c b/src/os/unix/ngx_socket.c
index 0746fa0ec..941fc8cd1 100644
--- a/src/os/unix/ngx_socket.c
+++ b/src/os/unix/ngx_socket.c
@@ -1,5 +1,6 @@
-#include <ngx_socket.h>
+#include <ngx_config.h>
+#include <ngx_core.h>
/*
@@ -10,7 +11,8 @@
ioctl() and fcntl() are syscalls on FreeBSD, Solaris 7/8 and Linux
*/
-#if 1
+
+#if (HAVE_FIONBIO)
int ngx_nonblocking(ngx_socket_t s)
{
@@ -19,6 +21,7 @@ int ngx_nonblocking(ngx_socket_t s)
return ioctl(s, FIONBIO, &nb);
}
+
int ngx_blocking(ngx_socket_t s)
{
unsigned long nb = 0;
@@ -27,3 +30,42 @@ int ngx_blocking(ngx_socket_t s)
}
#endif
+
+
+#ifdef __FreeBSD__
+
+int ngx_tcp_nopush(ngx_socket_t s)
+{
+ int tcp_nopush;
+
+ tcp_nopush = 1;
+
+ return setsockopt(s, IPPROTO_TCP, TCP_NOPUSH,
+ (const void *) &tcp_nopush, sizeof(int));
+}
+
+
+int ngx_tcp_push(ngx_socket_t s)
+{
+ int tcp_nopush;
+
+ tcp_nopush = 0;
+
+ return setsockopt(s, IPPROTO_TCP, TCP_NOPUSH,
+ (const void *) &tcp_nopush, sizeof(int));
+}
+
+#else
+
+
+int ngx_tcp_nopush(ngx_socket_t s)
+{
+ return NGX_OK;
+}
+
+int ngx_tcp_push(ngx_socket_t s)
+{
+ return NGX_OK;
+}
+
+#endif