--- Makefile 10 Oct 2002 09:51:03 -0000 1.51 +++ Makefile 15 Oct 2002 06:47:28 -0000 @@ -73,7 +73,8 @@ net/basicSocket.ml net/tcpBufferedSocket.ml \ net/tcpClientSocket.ml net/tcpServerSocket.ml \ net/udpSocket.ml net/http_server.ml net/http_client.ml \ + net/iptos.ml net/iptos_c.c \ net/multicast.ml net/multicast_c.c CHAT_SRCS = chat/chat_messages.ml\ --- donkey/donkeyClient.ml 10 Oct 2002 09:51:04 -0000 1.16 +++ donkey/donkeyClient.ml 15 Oct 2002 06:47:29 -0000 @@ -39,6 +39,7 @@ open DonkeyMftp open DonkeyProtoCom open TcpBufferedSocket +open Iptos open DonkeyTypes open DonkeyOneFile open DonkeyOptions @@ -886,7 +887,8 @@ | _ -> () let init_connection sock = + ignore (setsock_iptos_throughput (fd (TcpBufferedSocket.sock sock))); TcpBufferedSocket.set_read_controler sock download_control; TcpBufferedSocket.set_write_controler sock upload_control; set_rtimeout sock !!client_timeout; --- donkey/donkeyOvernet.ml 10 Oct 2002 09:51:04 -0000 1.5 +++ donkey/donkeyOvernet.ml 15 Oct 2002 06:47:31 -0000 @@ -21,6 +21,7 @@ open BasicSocket open TcpBufferedSocket +open Iptos open LittleEndian open GuiTypes @@ -606,3 +607,6 @@ udp_sock := Some (UdpSocket.create (Ip.to_inet_addr !!donkey_bind_addr) (!!overnet_port) (udp_handler udp_client_handler)); +(* match !udp_sock with + None -> () + | Some sock -> ignore (setsock_iptos_throughput (fd (UdpSocket.sock sock))); *) add_session_timer enabler 1. try_connect; add_session_option_timer enabler overnet_query_peer_period query_next_peers; add_session_timer enabler 1200. (fun _ -> --- /dev/null Sat Mar 16 01:29:46 2002 +++ net/iptos.mli Sun Oct 13 21:55:50 2002 @@ -0,1 +1,4 @@ +type socket = Unix.file_descr + +val setsock_iptos_throughput: socket -> int --- /dev/null Sat Mar 16 01:29:46 2002 +++ net/iptos.ml Sun Oct 13 21:54:14 2002 @@ -0,1 +1,8 @@ +open Unix + +type socket = Unix.file_descr + +external setsock_iptos_throughput: socket -> int = "setsock_iptos_throughput" + + --- /dev/null Sat Mar 16 01:29:46 2002 +++ net/iptos_c.c Mon Oct 14 00:57:14 2002 @@ -0,0 +1,18 @@ +#include <sys/ioctl.h> +#include "caml/mlvalues.h" +#include <unistd.h> +#include <arpa/inet.h> +#include <netinet/in.h> +#include <netinet/ip.h> +#include <sys/types.h> +#include <stdio.h> +#include <sys/socket.h> + +value setsock_iptos_throughput(value sock_v) +{ + int sock = Int_val(sock_v); + int tos = IPTOS_THROUGHPUT /* IPTOS_MINCOST obsoleted by ECN */; + return Val_int(setsockopt(sock, + IPPROTO_IP, IP_TOS, + &tos, sizeof(tos))); +}