1 (* Copyright 2001, 2002 b8_bavard, b8_fee_carabine, INRIA *)
3 This file is part of mldonkey.
5 mldonkey is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 mldonkey is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with mldonkey; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 Closed_for_timeout
(* timeout exceeded *)
22 | Closed_for_lifetime
(* lifetime exceeded *)
23 | Closed_by_peer
(* end of file *)
24 | Closed_for_error
of string
25 | Closed_by_user
(* the operation was completed *)
27 | Closed_connect_failed
28 | Closed_for_exception
of exn
31 CLOSED
of close_reason
32 | RTIMEOUT
| WTIMEOUT
| LTIMEOUT
| CAN_READ
| CAN_WRITE
35 type handler
= t
-> event
-> unit
37 val infinite_timeout
: float
38 val last_time
: unit -> int
39 val update_time
: unit -> unit
41 val fd
: t
-> Unix.file_descr
42 val must_write
: t
-> bool -> unit
43 val must_read
: t
-> bool -> unit
44 val set_rtimeout
: t
-> float -> unit
45 val set_wtimeout
: t
-> float -> unit
46 val set_lifetime
: t
-> float -> unit
47 val set_handler
: t
-> handler
-> unit
48 val handler
: t
-> handler
49 val closed
: t
-> bool
51 (* val set_before_select : t -> (t -> unit) -> unit *)
53 val create
: string -> Unix.file_descr
-> handler
-> t
54 val create_blocking
: string -> Unix.file_descr
-> handler
-> t
55 val set_printer
: t
-> (t
-> string) -> unit
56 val close
: t
-> close_reason
-> unit
57 val shutdown
: t
-> close_reason
-> unit
59 val set_before_select_hook
: (unit -> unit) -> unit
60 val set_after_select_hook
: (unit -> unit) -> unit
62 (* val add_timer: float -> (unit -> unit) -> unit *)
65 val add_timer
: float -> (timer
-> unit) -> unit
66 val add_infinite_timer
: float -> (unit -> unit) -> unit
67 val add_session_timer
: bool ref -> float -> (unit -> unit) -> unit
68 val add_session_option_timer
: bool ref -> float Options.option_record
-> (unit -> unit) -> unit
69 val add_infinite_option_timer
: float Options.option_record
-> (unit -> unit) -> unit
71 val reactivate_timer
: timer
-> unit
72 val loop
: unit -> unit
74 val nb_sockets
: unit -> int
76 val stats
: Buffer.t
-> t
-> unit
78 val minf
: float -> float -> float
79 val maxf
: float -> float -> float
81 val set_allow_write
: t
-> bool ref -> unit
82 val set_allow_read
: t
-> bool ref -> unit
84 val print_sockets
: Buffer.t
-> unit
85 val print_socket
: Buffer.t
-> t
-> unit
87 val info
: t
-> string
91 val set_dump_info
: t
-> (Buffer.t
-> unit) -> unit
93 external use_poll
: bool -> unit = "ml_use_poll"
95 val prevent_close
: t
-> unit
96 val close_all
: unit -> unit
100 external setsock_iptos_throughput
: Unix.file_descr
-> int = "ml_setsock_iptos_throughput"
102 val sock_num
: t
-> int
103 val string_of_date
: int -> string
104 val date_of_int
: int -> float
105 val normalize_time
: int -> int
107 val use_threads
: bool ref
108 external has_threads
: unit -> bool = "ml_has_pthread"
109 val get_rtimeout
: t
-> float * float
110 val int64_time
: unit -> int64
111 val current_time
: unit -> float
113 val string_of_reason
: close_reason
-> string
114 val string_of_basic_event
: event
-> string
116 val loop_delay
: float ref
118 val socket_keepalive
: bool ref
122 1 : summary every second
126 val verbose_bandwidth
: int ref
127 val add_bandwidth_second_timer
: (unit -> unit) -> unit