fsm and networks

Dustin Sallings <>
Mon May 3 02:24:27 CEST 2004


On May 1, 2004, at 10:09, Vance Shipley wrote:

> Your FSM isn't really an FSM when you don't track state.

	Hmm...I guess I'm a bit confused, then.  Is gen_fsm not good for this 
task?  I imagined there would be a few different states:

connected       -- first connected, but not authenticated
authenticated   -- connected and authenticated
ready_for_query -- you know, ready for a query
query_pending   -- a query has been issued and results are coming back

	The state is changed by the server (connected is initial state).  
Postgres has a command that arrives from the back end indicating the 
state.  query_pending is the exception in that it's client-driven, but 
the server will send a message indicating when it's ready for queries 
again.

	This is primarily an exercise in learning OTP, but hey, I need a 
postgres driver, too and I've always wanted to implement the protocol.  
I can get two out of three without OTP, but I figured I'd go for three.

--
SPY                      My girlfriend asked me which one I like better.
pub  1024/3CAE01D5 1994/11/03 Dustin Sallings <>
|    Key fingerprint =  87 02 57 08 02 D0 DA D6  C8 0F 3E 65 51 98 D8 BE
L_______________________ I hope the answer won't upset her. ____________




More information about the erlang-questions mailing list