svn commit: r422731 - in head/net/anet: . files
John Marino
marino at FreeBSD.org
Sat Sep 24 16:43:45 UTC 2016
Author: marino
Date: Sat Sep 24 16:43:44 2016
New Revision: 422731
URL: https://svnweb.freebsd.org/changeset/ports/422731
Log:
net/anet: Implement TCP_NODELAY socket option
Added:
head/net/anet/files/patch-add-TCP_NODELAY (contents, props changed)
Modified:
head/net/anet/Makefile
Modified: head/net/anet/Makefile
==============================================================================
--- head/net/anet/Makefile Sat Sep 24 16:10:39 2016 (r422730)
+++ head/net/anet/Makefile Sat Sep 24 16:43:44 2016 (r422731)
@@ -3,6 +3,7 @@
PORTNAME= anet
PORTVERSION= 0.3.3
+PORTREVISION= 1
CATEGORIES= net
MASTER_SITES= http://www.codelabs.ch/download/
DISTNAME= libanet-${PORTVERSION}
Added: head/net/anet/files/patch-add-TCP_NODELAY
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/net/anet/files/patch-add-TCP_NODELAY Sat Sep 24 16:43:44 2016 (r422731)
@@ -0,0 +1,59 @@
+--- src/anet-constants.ads.orig 2016-06-29 10:26:01 UTC
++++ src/anet-constants.ads
+@@ -45,6 +45,7 @@ package Anet.Constants is
+ -- Protocol levels --
+ ---------------------
+
++ IPPROTO_TCP : constant := 6; -- TCP
+ IPPROTO_IPV6 : constant := 41; -- IPv6
+ IPPROTO_ESP : constant := 50; -- ESP
+
+--- src/bsd/anet-os_constants.ads.orig 2016-06-29 10:26:01 UTC
++++ src/bsd/anet-os_constants.ads
+@@ -26,5 +26,6 @@ package Anet.OS_Constants is
+ IPV6_ADD_MEMBERSHIP : constant := 12; -- Join multicast group (IPv6)
+
+ O_NONBLOCK : constant := 4; -- Non-blocking sockets
++ TCP_NODELAY : constant := 1; -- Don't delay send to coalesce pkts
+
+ end Anet.OS_Constants;
+--- src/anet-sockets.ads.orig 2016-06-29 10:26:01 UTC
++++ src/anet-sockets.ads
+@@ -119,6 +119,12 @@ package Anet.Sockets is
+ Value : String);
+ -- Set socket option of given socket to specified string value.
+
++ procedure Set_Socket_Send_Delay
++ (Socket : Socket_Type;
++ Without_Delay : Boolean);
++ -- Set Nagle's Algorithm (socket may delay sending data)
++ -- By default, sockets have the algorithm enabled and can delay sending
++
+ private
+
+ use type Interfaces.C.int;
+--- src/anet-sockets.adb.orig 2016-06-29 10:26:01 UTC
++++ src/anet-sockets.adb
+@@ -279,4 +279,22 @@ package body Anet.Sockets is
+ Value & "'");
+ end Set_Socket_Option;
+
++ -------------------------------------------------------------------------
++
++ procedure Set_Socket_Send_Delay
++ (Socket : Socket_Type;
++ Without_Delay : Boolean)
++ is
++ Val : C.int := C.int (Boolean'Pos (Without_Delay));
++ begin
++ Errno.Check_Or_Raise
++ (Result => Thin.C_Setsockopt
++ (S => Socket.Sock_FD,
++ Level => Constants.Sys.IPPROTO_TCP,
++ Optname => OS_Constants.TCP_NODELAY,
++ Optval => Val'Address,
++ Optlen => Val'Size / 8),
++ Message => "Unable to set socket option TCP_NODELAY");
++ end Set_Socket_Send_Delay;
++
+ end Anet.Sockets;
More information about the svn-ports-head
mailing list