mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
THRIFT-2856 refactor erlang basic transports and unify interfaces
Client: Erlang Patch: Nobuaki Sukegawa Add read_exact default implementation so that every transport is usable under framed transport.
This commit is contained in:
parent
a559f8d903
commit
149ecc1a5f
@ -101,8 +101,12 @@ when is_integer(Len), Len >= 0 ->
|
||||
|
||||
read_exact(Transport = #t_transport{module = Module}, Len)
|
||||
when is_integer(Len), Len >= 0 ->
|
||||
{NewState, Result} = Module:read_exact(Transport#t_transport.state, Len),
|
||||
{Transport#t_transport{state = NewState}, Result}.
|
||||
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)
|
||||
end.
|
||||
|
||||
|
||||
write(Transport = #t_transport{module = Module}, Data) ->
|
||||
|
Loading…
Reference in New Issue
Block a user