blob: 1a85809b0623324920268914c110dc7e8aba475e [file] [log] [blame]
iproctor9a41a0c2007-07-16 21:59:24 +00001open Thrift
2module S = TServer
3
4class t pf st itf otf ipf opf =
5object
6 inherit S.t pf st itf otf ipf opf
7 method serve =
8 try
9 st#listen;
10 let c = st#accept in
11 let proc = pf#getProcessor c in
12 let itrans = itf#getTransport c in
13 let otrans = try
14 otf#getTransport c
15 with e -> itrans#close; raise e
16 in
17 let inp = ipf#getProtocol itrans in
18 let op = opf#getProtocol otrans in
19 try
20 while (proc#process inp op) do () done;
21 itrans#close; otrans#close
22 with e -> itrans#close; otrans#close; raise e
23 with _ -> ()
24end