Thrift: OCaml TSocket fix
Summary: Now closes input channel on close. Also, transport exceptions are cleaner.
Reviewed by: mcslee
Test plan: Yes
Revert plan: yes
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665198 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/ocaml/src/TServerSocket.ml b/lib/ocaml/src/TServerSocket.ml
index ac98b08..9e79706 100644
--- a/lib/ocaml/src/TServerSocket.ml
+++ b/lib/ocaml/src/TServerSocket.ml
@@ -11,11 +11,12 @@
Unix.listen s 256
method close =
match sock with
- Some s -> Unix.shutdown s Unix.SHUTDOWN_ALL; Unix.close s; sock <- None
+ Some s -> Unix.shutdown s Unix.SHUTDOWN_ALL; Unix.close s;
+ sock <- None
| _ -> ()
method acceptImpl =
match sock with
Some s -> let (fd,_) = Unix.accept s in
new TChannelTransport.t (Unix.in_channel_of_descr fd,Unix.out_channel_of_descr fd)
- | _ -> Transport.raise_TTransportExn "ServerSocket: Not listening but tried to accept" Transport.NOT_OPEN
+ | _ -> raise (Transport.E (Transport.NOT_OPEN,"TServerSocket: Not listening but tried to accept"))
end