This commit is contained in:
Xiang Li 2013-07-09 14:58:59 -07:00
parent 9efba81c09
commit fad972304c
3 changed files with 6 additions and 9 deletions

View File

@ -234,8 +234,6 @@ func main() {
} }
func createTransporter(st int) transporter { func createTransporter(st int) transporter {
t := transporter{} t := transporter{}

View File

@ -4,9 +4,9 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil"
"github.com/coreos/go-raft" "github.com/coreos/go-raft"
"io" "io"
"io/ioutil"
"net/http" "net/http"
) )
@ -84,7 +84,7 @@ func (t transporter) SendSnapshotRequest(server *raft.Server, peer *raft.Peer, r
// Get the the client address of the leader in the cluster // Get the the client address of the leader in the cluster
func (t transporter) GetLeaderClientAddress() string { func (t transporter) GetLeaderClientAddress() string {
resp, _ := t.Get(raftServer.Leader()+"/client") resp, _ := t.Get(raftServer.Leader() + "/client")
if resp != nil { if resp != nil {
body, _ := ioutil.ReadAll(resp.Body) body, _ := ioutil.ReadAll(resp.Body)
resp.Body.Close() resp.Body.Close()
@ -105,7 +105,6 @@ func (t transporter) Post(path string, body io.Reader) (*http.Response, error) {
} }
} }
// Send server side GET request // Send server side GET request
func (t transporter) Get(path string) (*http.Response, error) { func (t transporter) Get(path string) (*http.Response, error) {
if t.client != nil { if t.client != nil {