From 8361bf05659f9d1e458d76f8ee0657ea5e009b6a Mon Sep 17 00:00:00 2001 From: iproctor Date: Thu, 10 Apr 2008 00:31:55 +0000 Subject: [PATCH] ocaml and haskell thrift clients now calling readMessageEnd Summary: I neglected to make the call to readMessageEnd if the client read an app exception in the haskell and ocaml code. Fixed now. The test cases for both now also compile with the new ThriftTest.thrift (though haskell's is still not doing anything but echoing the args) Reviewed By: dreiss Test Plan: Ran test code. This bug would actually never show up because there's only tbinaryprotocol implemented for these languages and that does nothing on a readMessageEnd. Revert: OK DiffCamp Revision: 11377 git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665651 13f79535-47bb-0310-9956-ffa450edef68 --- compiler/cpp/src/generate/t_hs_generator.cc | 3 ++- compiler/cpp/src/generate/t_ocaml_generator.cc | 3 ++- test/hs/Server.hs | 1 + test/ocaml/server/TestServer.ml | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/cpp/src/generate/t_hs_generator.cc b/compiler/cpp/src/generate/t_hs_generator.cc index e5fcb60f..fec7d3f9 100644 --- a/compiler/cpp/src/generate/t_hs_generator.cc +++ b/compiler/cpp/src/generate/t_hs_generator.cc @@ -868,7 +868,8 @@ void t_hs_generator::generate_service_client(t_service* tservice) { indent() << "(fname, mtype, rseqid) <- readMessageBegin ip" << endl; f_client_ << indent() << "if mtype == M_EXCEPTION then do" << endl << - indent() << " x <- readAppExn ip" << endl; + indent() << " x <- readAppExn ip" << endl << + indent() << " readMessageEnd ip" << endl; f_client_ << indent() << " throwDyn x" << endl; f_client_ << diff --git a/compiler/cpp/src/generate/t_ocaml_generator.cc b/compiler/cpp/src/generate/t_ocaml_generator.cc index 745d8f73..7178fc4a 100644 --- a/compiler/cpp/src/generate/t_ocaml_generator.cc +++ b/compiler/cpp/src/generate/t_ocaml_generator.cc @@ -916,7 +916,8 @@ void t_ocaml_generator::generate_service_client(t_service* tservice) { indent() << " let x = Application_Exn.read iprot in" << endl; indent_up(); f_service_ << - indent() << " raise (Application_Exn.E x)" << endl; + indent() << " (iprot#readMessageEnd;" << + indent() << " raise (Application_Exn.E x))" << endl; indent_down(); f_service_ << indent() << "else ());" << endl; diff --git a/test/hs/Server.hs b/test/hs/Server.hs index ee4fd206..511d01e4 100644 --- a/test/hs/Server.hs +++ b/test/hs/Server.hs @@ -28,6 +28,7 @@ instance ThriftTest_Iface TestHandler where testMulti a a1 a2 a3 a4 a5 a6 = return (Xtruct Nothing Nothing Nothing Nothing) testException a c = throwDyn (Xception (Just 1) (Just "bya")) testMultiException a c1 c2 = return (Xtruct Nothing Nothing Nothing Nothing) + testAsync a (Just i) = do print i main = do (run_basic_server TestHandler process 9090) `catchDyn` (\(TransportExn s t) -> print s) diff --git a/test/ocaml/server/TestServer.ml b/test/ocaml/server/TestServer.ml index 3768f5dc..67157383 100644 --- a/test/ocaml/server/TestServer.ml +++ b/test/ocaml/server/TestServer.ml @@ -97,6 +97,8 @@ object (self) let res = new xtruct in res#set_string_thing (sod a1); res + method testAsync i = + Unix.sleep (sod i) end;; let h = new test_handler in -- 2.17.1