Check for error when sending RPC byte

This commit is contained in:
Armon Dadgar 2014-01-10 12:09:19 -08:00
parent 992db5d291
commit 28c1e556d6
1 changed files with 5 additions and 1 deletions

View File

@ -80,6 +80,10 @@ func (l *RaftLayer) Dial(address string, timeout time.Duration) (net.Conn, error
} }
// Write the Raft byte to set the mode // Write the Raft byte to set the mode
conn.Write([]byte{byte(rpcRaft)}) _, err = conn.Write([]byte{byte(rpcRaft)})
if err != nil {
conn.Close()
return nil, err
}
return conn, err return conn, err
} }