[erlang-questions] Upgrading a gen_tcp acceptor process
Sam Bobroff
sam@REDACTED
Tue Mar 29 07:58:54 CEST 2011
Hello again Erlangers,
I've been teaching myself about code reloading (or "hot upgrades") and
I've hit problem with my very simple test application.
The problem occurs in a server that accepts TCP connections and is:
(1) To do it's work, the process must at some point call
gen_tcp:accept() to accept new connections, which blocks.
(2) To be upgraded, the process must handle system messages in a receive
loop.
I can't see a way to reconcile (1) and (2) without polling constantly by
adding a timeout to gen_tcp:accept(), and this seems to be a horrible
solution. Given that this is probably a very common situation, how am I
supposed to handle it?
(I don't want to confuse things, but it seems like the interface to
gen_tcp:accept() causes another problem: It can't be put in a gen_server
for the same reason. It seems "obvious" that there should be a message
passing interface to it but I don't see an EEP for it; is there some
reason why it couldn't work that way?)
Thanks in advance for any comments or pointers!
Peace,
Sam.
More information about the erlang-questions
mailing list