Pave the way for a new message type for oneway function calls.
For now, just define the constant in all languages and make
server implementations treat it the same way as a normal call.
Only C++ and Erlang currently check the message type (on the
server side).
There is a little bit of redundancy in the Erlang code, but
the alternative is a bit gross, and this split-up will be
necessary eventually when we start handling one-way calls
differently.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@761389
13f79535-47bb-0310-9956-
ffa450edef68
endl <<
indent() << "iprot->readMessageBegin(fname, mtype, seqid);" << endl <<
endl <<
- indent() << "if (mtype != apache::thrift::protocol::T_CALL) {" << endl <<
+ indent() << "if (mtype != apache::thrift::protocol::T_CALL && mtype != apache::thrift::protocol::T_ONEWAY) {" << endl <<
indent() << " iprot->skip(apache::thrift::protocol::T_STRUCT);" << endl <<
indent() << " iprot->readMessageEnd();" << endl <<
indent() << " iprot->getTransport()->readEnd();" << endl <<
enum {
TMessageType_CALL = 1,
TMessageType_REPLY = 2,
- TMessageType_EXCEPTION = 3
+ TMessageType_EXCEPTION = 3,
+ TMessageType_ONEWAY = 4
};
enum {
enum TMessageType {
T_CALL = 1,
T_REPLY = 2,
- T_EXCEPTION = 3
+ T_EXCEPTION = 3,
+ T_ONEWAY = 4
};
/**
{
Call = 1,
Reply = 2,
- Exception = 3
+ Exception = 3,
+ Oneway = 4
}
}
-define(tMessageType_CALL, 1).
-define(tMessageType_REPLY, 2).
-define(tMessageType_EXCEPTION, 3).
+-define(tMessageType_ONEWAY, 4).
% TApplicationException
-define(TApplicationException_Structure,
type = ?tMessageType_CALL} ->
ok = handle_function(State, list_to_atom(Function)),
loop(State);
+ #protocol_message_begin{name = Function,
+ type = ?tMessageType_ONEWAY} ->
+ ok = handle_function(State, list_to_atom(Function)),
+ loop(State);
{error, timeout} ->
thrift_protocol:close_transport(OProto),
ok;
data Message_type = M_CALL
| M_REPLY
| M_EXCEPTION
+ | M_ONEWAY
| M_UNKNOWN
deriving Eq
instance Enum Message_type where
M_CALL -> 1
M_REPLY -> 2
M_EXCEPTION -> 3
+ M_ONEWAY -> 4
M_UNKNOWN -> -1
toEnum t = case t of
1 -> M_CALL
2 -> M_REPLY
3 -> M_EXCEPTION
+ 4 -> M_ONEWAY
_ -> M_UNKNOWN
public static final byte CALL = 1;
public static final byte REPLY = 2;
public static final byte EXCEPTION = 3;
+ public static final byte ONEWAY = 4;
}
| CALL
| REPLY
| EXCEPTION
+ | ONEWAY
let message_type_to_i = function
| CALL -> 1
| REPLY -> 2
| EXCEPTION -> 3
+ | ONEWAY -> 4
let message_type_of_i = function
| 1 -> CALL
| 2 -> REPLY
| 3 -> EXCEPTION
+ | 4 -> ONEWAY
| _ -> raise Thrift_error
class virtual t (trans: Transport.t) =
use constant CALL => 1;
use constant REPLY => 2;
use constant EXCEPTION => 3;
+use constant ONEWAY => 4;
1;
package Thrift::TException;
const CALL = 1;
const REPLY = 2;
const EXCEPTION = 3;
+ const ONEWAY = 4;
}
/**
CALL = 1
REPLY = 2
EXCEPTION = 3
+ ONEWAY = 4
class TProcessor:
CALL = 1
REPLY = 2
EXCEPTION = 3
+ ONEWAY = 4
end
end