You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by dr...@apache.org on 2008/06/11 00:58:14 UTC

svn commit: r666382 - /incubator/thrift/trunk/lib/alterl/src/thrift_processor.erl

Author: dreiss
Date: Tue Jun 10 15:58:14 2008
New Revision: 666382

URL: http://svn.apache.org/viewvc?rev=666382&view=rev
Log:
Fix responses for void functions

Modified:
    incubator/thrift/trunk/lib/alterl/src/thrift_processor.erl

Modified: incubator/thrift/trunk/lib/alterl/src/thrift_processor.erl
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/alterl/src/thrift_processor.erl?rev=666382&r1=666381&r2=666382&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/alterl/src/thrift_processor.erl (original)
+++ incubator/thrift/trunk/lib/alterl/src/thrift_processor.erl Tue Jun 10 15:58:14 2008
@@ -51,15 +51,24 @@
                           [Function, Params, Micro/1000.0]),
     
     ReplyType = Service:function_info(Function, reply_type),
+    StructName = atom_to_list(Function) ++ "_result",
     
     case Result of
-        {reply, Reply} -> 
-            StructName = atom_to_list(Function) ++ "_result",
-            thrift_protocol:write(OProto, #protocol_message_begin{
-                            name = StructName,
-                            type = ?tMessageType_REPLY,
-                            seqid = 0}),
-            thrift_protocol:write(OProto, {{struct, [{0, ReplyType}]}, {StructName, Reply}}),
-            thrift_protocol:write(OProto, message_end)
+        {reply, ReplyData} -> 
+            Reply = {{struct, [{0, ReplyType}]}, {StructName, ReplyData}},
+            ok = send_reply(OProto, Function, Reply);
+
+        ok when ReplyType == {struct, []} ->
+            ok = send_reply(OProto, Function, {ReplyType, {StructName}})
     end,
     ok.
+
+
+send_reply(OProto, Function, Reply) ->
+    ok = thrift_protocol:write(OProto, #protocol_message_begin{
+                                 name = atom_to_list(Function),
+                                 type = ?tMessageType_REPLY,
+                                 seqid = 0}),
+    ok = thrift_protocol:write(OProto, Reply),
+    ok = thrift_protocol:write(OProto, message_end),
+    ok.