commit
085eed6569
|
@ -161,7 +161,6 @@ func (t *HTTPTransporter) appendEntriesHandler(server *Server) http.HandlerFunc
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
traceln(server.Name(), "RECV /appendEntries")
|
traceln(server.Name(), "RECV /appendEntries")
|
||||||
|
|
||||||
defer r.Body.Close()
|
|
||||||
req := &AppendEntriesRequest{}
|
req := &AppendEntriesRequest{}
|
||||||
if _, err := req.decode(r.Body); err != nil {
|
if _, err := req.decode(r.Body); err != nil {
|
||||||
http.Error(w, "", http.StatusBadRequest)
|
http.Error(w, "", http.StatusBadRequest)
|
||||||
|
@ -181,7 +180,6 @@ func (t *HTTPTransporter) requestVoteHandler(server *Server) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
traceln(server.Name(), "RECV /requestVote")
|
traceln(server.Name(), "RECV /requestVote")
|
||||||
|
|
||||||
defer r.Body.Close()
|
|
||||||
req := &RequestVoteRequest{}
|
req := &RequestVoteRequest{}
|
||||||
if _, err := req.decode(r.Body); err != nil {
|
if _, err := req.decode(r.Body); err != nil {
|
||||||
http.Error(w, "", http.StatusBadRequest)
|
http.Error(w, "", http.StatusBadRequest)
|
||||||
|
|
|
@ -388,6 +388,7 @@ func TestServerMultiNode(t *testing.T) {
|
||||||
var leader *Server
|
var leader *Server
|
||||||
for _, name := range names {
|
for _, name := range names {
|
||||||
server := newTestServer(name, transporter)
|
server := newTestServer(name, transporter)
|
||||||
|
defer server.Stop()
|
||||||
|
|
||||||
mutex.Lock()
|
mutex.Lock()
|
||||||
servers[name] = server
|
servers[name] = server
|
||||||
|
|
Loading…
Reference in New Issue