You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ns...@apache.org on 2015/11/15 06:02:32 UTC
[5/5] thrift git commit: THRIFT-3423 First call to
thrift_transport:read_exact fails to dispatch correct function Client: Erlang
Patch: Nobuaki Sukegawa
THRIFT-3423 First call to thrift_transport:read_exact fails to dispatch correct function
Client: Erlang
Patch: Nobuaki Sukegawa
This closes #694
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/97a48988
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/97a48988
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/97a48988
Branch: refs/heads/master
Commit: 97a48988de6a7ac513311456a6f6d3ef7f587639
Parents: 7f404fd
Author: Nobuaki Sukegawa <ns...@apache.org>
Authored: Sat Nov 14 18:49:45 2015 +0900
Committer: Nobuaki Sukegawa <ns...@apache.org>
Committed: Sun Nov 15 14:00:18 2015 +0900
----------------------------------------------------------------------
lib/erl/src/thrift_transport.erl | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/97a48988/lib/erl/src/thrift_transport.erl
----------------------------------------------------------------------
diff --git a/lib/erl/src/thrift_transport.erl b/lib/erl/src/thrift_transport.erl
index 31dac86..526050f 100644
--- a/lib/erl/src/thrift_transport.erl
+++ b/lib/erl/src/thrift_transport.erl
@@ -101,11 +101,14 @@ when is_integer(Len), Len >= 0 ->
read_exact(Transport = #t_transport{module = Module}, Len)
when is_integer(Len), Len >= 0 ->
- case erlang:function_exported(Module, read_exact, 2) of
- true ->
- {NewState, Result} = Module:read_exact(Transport#t_transport.state, Len),
- {Transport#t_transport{state = NewState}, Result};
- false -> read(Transport, Len)
+ case lists:keyfind(read_exact, 1, Module:module_info(exports)) of
+ {read_exact, 2} ->
+ io:fwrite("HAS EXACT"),
+ {NewState, Result} = Module:read_exact(Transport#t_transport.state, Len),
+ {Transport#t_transport{state = NewState}, Result};
+ _ ->
+ io:fwrite("~p NO EXACT", [Module]),
+ read(Transport, Len)
end.