THRIFT-3423 First call to thrift_transport:read_exact fails to dispatch correct function
Client: Erlang
Patch: Nobuaki Sukegawa

This closes #694
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 @@
 
 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.