Merge pull request #52 from benbjohnson/50-server-event-loop

Refactor server event loop
Merge https://github.com/benbjohnson/go-raft
[Fix #52] Detect new leader with same term as candidate in processAppendEntriesRequest
Merge pull request #54 from xiangli-cmu/master

Fix #52
when candidate stepdown it should break the loop; gofmt
Merge pull request #55 from xiangli-cmu/master

when candidate stepdown it should break the loop; gofmt
fix break in select
when change the state to leader, we should also update the s.leader to its own name
Merge pull request #56 from xiangli-cmu/master

Fix break in select
fix peer stop channel problem
Merge pull request #57 from xiangli-cmu/master

fix peer stop channel problem
fix election timeout problem
Merge pull request #59 from coreos/master

Fix Election timeout
create new channel before start heartbeat to avoid recv stop signal from old heartbeat func
Merge pull request #60 from coreos/master

create new channel before start heartbeat
do not send commit signal if it came from old leader
record the value of the commit result before remvoe it
Merge pull request #61 from coreos/master

Fix two problems
Remove the lock in init(). Since addPeer func() require that lock. When do log replay in the init(), there will be deadlock
Merge pull request #62 from coreos/master

Remove the lock in init()