feat(peer_server): stop service when removed

It doesn't modify the exit logic, but makes external code know
when removal happens and be able to determine what it should do.
This commit is contained in:
Yicheng Qin
2014-04-30 16:04:58 -07:00
parent 997e7d3bf4
commit ba36a16bc5
3 changed files with 38 additions and 7 deletions

View File

@@ -2,7 +2,6 @@ package server
import (
"encoding/binary"
"os"
"github.com/coreos/etcd/log"
"github.com/coreos/etcd/third_party/github.com/goraft/raft"
@@ -65,7 +64,7 @@ func applyRemove(c *RemoveCommand, context raft.Context) (uint64, error) {
// command and need to be removed
if context.CommitIndex() > ps.joinIndex && ps.joinIndex != 0 {
log.Debugf("server [%s] is removed", context.Server().Name())
os.Exit(0)
ps.asyncRemove()
} else {
// else ignore remove
log.Debugf("ignore previous remove command.")