Is gen_server handle_info synchronous?

Chris Duesing <>
Wed Mar 3 21:37:06 CET 2010


I am working on some code that connects to a streaming data service
via gen_tcp:connect(). I am doing this from inside a gen_server to
benefit from OTP goodness. But, since it didn't seem to fit the
paradigm to have an infinite loop of reading from the socket with
recv, I left it as {active, once} and use handle_info to receive
blocks of data. Whenever I receive an incomplete message in
handle_info I just add it to the state, and then prepend it to the
data I receive the next time handle_info is called. Once I started
testing this code I am seeing that the data saved in the state is not
available the next time handle_info is called. I guess I assumed that
the gen_server would complete requests serially, is this not the case
or am I missing something?

Thanks,

Chris


More information about the erlang-questions mailing list