File tree Expand file tree Collapse file tree 5 files changed +10
-10
lines changed
Expand file tree Collapse file tree 5 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ val connect :
3131val serve :
3232 mode :server_mode ->
3333 sockaddr :Lwt_unix .sockaddr ->
34- ?timeout : int -> (ic -> oc -> unit io ) -> unit io
34+ ?timeout : int -> (Lwt_unix .sockaddr -> ic -> oc -> unit io ) -> unit io
3535
3636val close_in : 'a Lwt_io .channel -> unit
3737val close_out : 'a Lwt_io .channel -> unit
Original file line number Diff line number Diff line change @@ -54,12 +54,12 @@ module Tcp_server = struct
5454 Lwt_unix. listen sock 15 ;
5555 sock) ()
5656
57- let process_accept ?timeout callback (client ,_ ) =
57+ let process_accept ?timeout callback (client , sockaddr ) =
5858 Lwt_unix. setsockopt client Lwt_unix. TCP_NODELAY true ;
5959 let ic = Lwt_io. of_fd ~mode: Lwt_io. input client in
6060 let oc = Lwt_io. of_fd ~mode: Lwt_io. output client in
6161
62- let c = callback ic oc in
62+ let c = callback sockaddr ic oc in
6363 let events = match timeout with
6464 | None -> [c]
6565 | Some t -> [c; (Lwt_unix. sleep (float_of_int t)) ] in
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ module Tcp_server : sig
3333 val init :
3434 sockaddr :Lwt_unix .sockaddr ->
3535 ?timeout : int ->
36- (input channel -> output channel -> unit Lwt .t ) ->
36+ (Lwt_unix .sockaddr -> input channel -> output channel -> unit Lwt .t ) ->
3737 unit Lwt .t
3838
3939 val close : input channel * output channel -> unit Lwt .t
Original file line number Diff line number Diff line change @@ -44,9 +44,9 @@ module Server = struct
4444 let t = Ssl. create_context Ssl. TLSv1 Ssl. Server_context
4545
4646 let accept fd =
47- lwt (afd,_ ) = Lwt_unix. accept fd in
47+ lwt (afd,sockaddr ) = Lwt_unix. accept fd in
4848 lwt sock = Lwt_ssl. ssl_accept afd t in
49- return (chans_of_fd sock)
49+ return (sockaddr, chans_of_fd sock)
5050
5151 let listen ?(nconn =20 ) ?password ~certfile ~keyfile sa =
5252 let fd = Lwt_unix. socket (Unix. domain_of_sockaddr sa) Unix. SOCK_STREAM 0 in
@@ -59,8 +59,8 @@ module Server = struct
5959 Ssl. use_certificate t certfile keyfile;
6060 fd
6161
62- let process_accept ~timeout callback (ic ,oc ) =
63- let c = callback ic oc in
62+ let process_accept ~timeout callback (sockaddr ,( ic ,oc ) ) =
63+ let c = callback sockaddr ic oc in
6464 let events = match timeout with
6565 | None -> [c]
6666 | Some t -> [c; (Lwt_unix. sleep (float_of_int t)) ] in
Original file line number Diff line number Diff line change 2525module Server : sig
2626 val accept :
2727 Lwt_unix .file_descr ->
28- (Lwt_io .input_channel * Lwt_io .output_channel ) Lwt .t
28+ (Lwt_unix .sockaddr * ( Lwt_io .input_channel * Lwt_io .output_channel ) ) Lwt .t
2929
3030 val listen :
3131 ?nconn : int ->
@@ -40,7 +40,7 @@ module Server : sig
4040 keyfile :string ->
4141 ?timeout : int ->
4242 Lwt_unix .sockaddr ->
43- (Lwt_io .input_channel -> Lwt_io .output_channel -> unit Lwt .t ) ->
43+ (Lwt_unix .sockaddr -> Lwt_io .input_channel -> Lwt_io .output_channel -> unit Lwt .t ) ->
4444 unit Lwt .t
4545end
4646
You can’t perform that action at this time.
0 commit comments