basho/riak_kv — pull request #845 by engelsanchez (2014-02-14 22:51:14+00:00)
Title: Fix use of fsm timeouts in 2i AAE

Joe pointed out some problems with FSM time outs in this code. It is
possible to set a timeout for the next FSM state, then receive a message
passed to handle_info and lose that timeout if not set again. Basically,
they are useless.
Refactored code to use gen_fsm:send_event_after() instead and managed
timer for the AAE pid request manually.
Also, a zero timeout transition was avoided by refactoring the code
around the next_partition state, which is now a simple function
directly executed from other states.
Also, if a request for an AAE pid every failed, the whole process would
have died silently. Instead, that is handled now like any other
partition error. So 2i AAE can happily go finishing the other
partitions.