You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2014/09/19 20:38:16 UTC

git commit: THRIFT-2706 D library does not support "oneway" message type Client: D Patch: Konrad Grochowski

Repository: thrift
Updated Branches:
  refs/heads/master 3dcef3768 -> be8326d58


THRIFT-2706 D library does not support "oneway" message type
Client: D
Patch: Konrad Grochowski

This closes #220


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/be8326d5
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/be8326d5
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/be8326d5

Branch: refs/heads/master
Commit: be8326d5862b134cf8d302923fb8f195c3d79124
Parents: 3dcef37
Author: Jens Geyer <je...@apache.org>
Authored: Fri Sep 19 20:35:46 2014 +0200
Committer: Jens Geyer <je...@apache.org>
Committed: Fri Sep 19 20:35:46 2014 +0200

----------------------------------------------------------------------
 lib/d/src/thrift/codegen/client.d   | 6 ++++--
 lib/d/src/thrift/protocol/compact.d | 6 +++---
 2 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/be8326d5/lib/d/src/thrift/codegen/client.d
----------------------------------------------------------------------
diff --git a/lib/d/src/thrift/codegen/client.d b/lib/d/src/thrift/codegen/client.d
index 9755ea8..09753da 100644
--- a/lib/d/src/thrift/codegen/client.d
+++ b/lib/d/src/thrift/codegen/client.d
@@ -184,8 +184,10 @@ template TClient(Interface, InputProtocol = TProtocol, OutputProtocol = void) if
           "TPargsStruct!(Interface, `" ~ methodName ~ "`)";
         code ~= paramStructType ~ " args = " ~ paramStructType ~ "();\n";
         code ~= paramAssignCode;
-        code ~= "oprot_.writeMessageBegin(TMessage(`" ~ methodName ~
-          "`, TMessageType.CALL, ++seqid_));\n";
+        code ~= "oprot_.writeMessageBegin(TMessage(`" ~ methodName ~ "`, ";
+        code ~= ((methodMetaFound && methodMeta.type == TMethodType.ONEWAY)
+                 ? "TMessageType.ONEWAY" : "TMessageType.CALL");
+        code ~= ", ++seqid_));\n";
         code ~= "args.write(oprot_);\n";
         code ~= "oprot_.writeMessageEnd();\n";
         code ~= "oprot_.transport.flush();\n";

http://git-wip-us.apache.org/repos/asf/thrift/blob/be8326d5/lib/d/src/thrift/protocol/compact.d
----------------------------------------------------------------------
diff --git a/lib/d/src/thrift/protocol/compact.d b/lib/d/src/thrift/protocol/compact.d
index e03b67d..9155c81 100644
--- a/lib/d/src/thrift/protocol/compact.d
+++ b/lib/d/src/thrift/protocol/compact.d
@@ -133,8 +133,8 @@ final class TCompactProtocol(Transport = TTransport) if (
 
   void writeMessageBegin(TMessage msg) {
     writeByte(cast(byte)PROTOCOL_ID);
-    writeByte((VERSION_N & VERSION_MASK) |
-      ((cast(int)msg.type << TYPE_SHIFT_AMOUNT) & TYPE_MASK));
+    writeByte(cast(byte)((VERSION_N & VERSION_MASK) |
+                         ((cast(int)msg.type << TYPE_SHIFT_AMOUNT) & TYPE_MASK)));
     writeVarint32(msg.seqid);
     writeString(msg.name);
   }
@@ -391,7 +391,7 @@ private:
       writeByte(cast(byte)(size << 4 | toCType(elemType)));
     } else {
       assert(size <= int.max);
-      writeByte(0xf0 | toCType(elemType));
+      writeByte(cast(byte)(0xf0 | toCType(elemType)));
       writeVarint32(cast(int)size);
     }
   }