blob: 9678e5ab8508081882395e1b63f3e3b324f5cf14 [file] [log] [blame]
open Thrift
module T = Transport
class t (i,o) =
object (self)
val mutable opened = true
inherit Transport.t
method isOpen = opened
method opn = ()
method close = close_in i; opened <- false
method read buf off len =
if opened then
try
really_input i buf off len; len
with _ -> raise (T.E (T.UNKNOWN, ("TChannelTransport: Could not read "^(string_of_int len))))
else
raise (T.E (T.NOT_OPEN, "TChannelTransport: Channel was closed"))
method write buf off len = output o buf off len
method flush = flush o
end