mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
THRIFT-3423 First call to thrift_transport:read_exact fails to dispatch correct function
Client: Erlang Patch: Nobuaki Sukegawa This closes #694
This commit is contained in:
parent
7f404fdef2
commit
97a48988de
@ -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.
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user