etcdserver: use timeout transport as peer transport

This pairs with remote timeout listeners.

etcd uses timeout listener, and times out the accepted connections
if there is no activity. So the idle connections may time out easily.
Becaus timeout transport doesn't reuse connections, it prevents using
timeouted connection.

This fixes the problem that etcd fail to get version of peers.
release-2.3
Yicheng Qin 2015-11-02 21:53:48 -08:00
parent 4fd65ecd4c
commit 0eee88a3d9
2 changed files with 4 additions and 2 deletions

View File

@ -211,7 +211,8 @@ func NewServer(cfg *ServerConfig) (*EtcdServer, error) {
haveWAL := wal.Exist(cfg.WALDir())
ss := snap.New(cfg.SnapDir())
pt, err := transport.NewTransport(cfg.PeerTLSInfo, cfg.peerDialTimeout())
// use timeout transport to pair with remote timeout listeners
pt, err := transport.NewTimeoutTransport(cfg.PeerTLSInfo, cfg.peerDialTimeout(), 0, 0)
if err != nil {
return nil, err
}

View File

@ -143,7 +143,8 @@ func (t *Transport) Start() error {
if err != nil {
return err
}
t.pipelineRt, err = transport.NewTransport(t.TLSInfo, t.DialTimeout)
// use timeout transport to pair with remote timeout listeners
t.pipelineRt, err = transport.NewTimeoutTransport(t.TLSInfo, t.DialTimeout, 0, 0)
if err != nil {
return err
}