[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 01/10: socket: TCP_CORK, TCP_NODELAY
From: |
Andy Wingo |
Subject: |
[Guile-commits] 01/10: socket: TCP_CORK, TCP_NODELAY |
Date: |
Thu, 9 Jun 2016 09:01:12 +0000 (UTC) |
wingo pushed a commit to branch master
in repository guile.
commit d7f39a36b1fb02bd7900eaad0c2f951d6f20b2ff
Author: Andy Wingo <address@hidden>
Date: Mon Mar 26 00:25:03 2012 +0200
socket: TCP_CORK, TCP_NODELAY
* libguile/socket.c (scm_init_socket): Define TCP_NODELAY and TCP_CORK
if they are available.
* doc/ref/posix.texi (Network Sockets and Communication): Add
documentation.
* NEWS: Add entry.
---
NEWS | 3 +++
doc/ref/posix.texi | 9 +++++++++
libguile/socket.c | 9 +++++++++
3 files changed, 21 insertions(+)
diff --git a/NEWS b/NEWS
index 8d2ec86..ff18b39 100644
--- a/NEWS
+++ b/NEWS
@@ -54,6 +54,9 @@ avoid the crashes that led to the introduction of locking,
but without
locks. For that reason we have removed port locks, and removed the
"_unlocked" port API variants that were introduced in 2.1.0.
+* New interfaces
+** `TCP_NODELAY' and `TCP_CORK' socket options, if provided by the system
+
* New deprecations
** `_IONBF', `_IOLBF', and `_IOFBF'
diff --git a/doc/ref/posix.texi b/doc/ref/posix.texi
index 53a71c1..8a8ab38 100644
--- a/doc/ref/posix.texi
+++ b/doc/ref/posix.texi
@@ -3178,6 +3178,15 @@ supporting that.
@end defvar
@end deffn
+For @code{IPPROTO_TCP} level the following @var{optname}s are defined
+(when provided by the system). For their meaning see @command{man 7
+tcp}.
+
address@hidden TCP_NODELAY
address@hidden TCP_CORK
+The @var{value} taken or returned is an integer.
address@hidden defvar
+
@deffn {Scheme Procedure} shutdown sock how
@deffnx {C Function} scm_shutdown (sock, how)
Sockets can be closed simply by using @code{close-port}. The
diff --git a/libguile/socket.c b/libguile/socket.c
index a6f1e5f..1c4f2ae 100644
--- a/libguile/socket.c
+++ b/libguile/socket.c
@@ -40,6 +40,7 @@
#include <sys/un.h>
#endif
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <netdb.h>
#include <arpa/inet.h>
@@ -1713,6 +1714,14 @@ scm_init_socket ()
scm_c_define ("MSG_DONTROUTE", scm_from_int (MSG_DONTROUTE));
#endif
+ /* TCP options. */
+#ifdef TCP_NODELAY
+ scm_c_define ("TCP_NODELAY", scm_from_int (TCP_NODELAY));
+#endif
+#ifdef TCP_CORK
+ scm_c_define ("TCP_CORK", scm_from_int (TCP_CORK));
+#endif
+
#ifdef IP_ADD_MEMBERSHIP
scm_c_define ("IP_ADD_MEMBERSHIP", scm_from_int (IP_ADD_MEMBERSHIP));
scm_c_define ("IP_DROP_MEMBERSHIP", scm_from_int (IP_DROP_MEMBERSHIP));
- [Guile-commits] branch master updated (9454068 -> 6788fab), Andy Wingo, 2016/06/09
- [Guile-commits] 01/10: socket: TCP_CORK, TCP_NODELAY,
Andy Wingo <=
- [Guile-commits] 07/10: put-char in Scheme, Andy Wingo, 2016/06/09
- [Guile-commits] 04/10: Undocument (ice-9 rw), Andy Wingo, 2016/06/09
- [Guile-commits] 09/10: Support `connect' on nonblocking sockets, Andy Wingo, 2016/06/09
- [Guile-commits] 10/10: Non-blocking accept/connect Scheme support, Andy Wingo, 2016/06/09
- [Guile-commits] 08/10: `accept' on nonblocking socket can return #f, Andy Wingo, 2016/06/09
- [Guile-commits] 02/10: put-char, put-string in (ice-9 ports internals), Andy Wingo, 2016/06/09
- [Guile-commits] 03/10: Add (ice-9 textual-ports), Andy Wingo, 2016/06/09
- [Guile-commits] 06/10: Update port documentation, rename sports to suspendable ports, Andy Wingo, 2016/06/09
- [Guile-commits] 05/10: Big ports documentation update, Andy Wingo, 2016/06/09