blob: 5407a8e8870da6b10eb33fac04711dd7ec6d20a9 [file] [log] [blame]
iproctor9a41a0c2007-07-16 21:59:24 +00001open Thrift
2module T = Transport
3
4class t (i,o) =
5object (self)
iproctore470aa32007-08-10 20:48:12 +00006 val mutable opened = true
iproctor9a41a0c2007-07-16 21:59:24 +00007 inherit Transport.t
iproctore470aa32007-08-10 20:48:12 +00008 method isOpen = opened
iproctor9a41a0c2007-07-16 21:59:24 +00009 method opn = ()
iproctore470aa32007-08-10 20:48:12 +000010 method close = close_in i; opened <- false
iproctor9a41a0c2007-07-16 21:59:24 +000011 method read buf off len =
iproctore470aa32007-08-10 20:48:12 +000012 if opened then
13 try
14 really_input i buf off len; len
15 with _ -> raise (T.E (T.UNKNOWN, ("TChannelTransport: Could not read "^(string_of_int len))))
16 else
17 raise (T.E (T.NOT_OPEN, "TChannelTransport: Channel was closed"))
iproctor9a41a0c2007-07-16 21:59:24 +000018 method write buf off len = output o buf off len
19 method flush = flush o
20end