mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-25 01:44:43 +01:00
fixup 3d8e552c6a
: validate streamrpc config in factory constructors
This commit is contained in:
parent
2da0e51fda
commit
03f9f81cb5
@ -34,7 +34,11 @@ func FromConfig(g *config.Global, in config.ConnectEnum) (*ClientFactory, error)
|
||||
return nil, errRPC
|
||||
}
|
||||
|
||||
return &ClientFactory{connecter: connecter, config: &streamrpc.ClientConfig{connConf}}, nil
|
||||
config := streamrpc.ClientConfig{connConf}
|
||||
if err := config.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ClientFactory{connecter: connecter, config: &config}, nil
|
||||
}
|
||||
|
||||
type ClientFactory struct {
|
||||
|
@ -10,7 +10,7 @@ func FromDaemonConfig(g *config.Global, in *config.RPCConfig) (*streamrpc.ConnCo
|
||||
if conf == nil {
|
||||
conf = g.RPC
|
||||
}
|
||||
return &streamrpc.ConnConfig{
|
||||
srpcConf := &streamrpc.ConnConfig{
|
||||
RxHeaderMaxLen: conf.RxHeaderMaxLen,
|
||||
RxStructuredMaxLen: conf.RxStructuredMaxLen,
|
||||
RxStreamMaxChunkSize: conf.RxStreamChunkMaxLen,
|
||||
@ -18,5 +18,9 @@ func FromDaemonConfig(g *config.Global, in *config.RPCConfig) (*streamrpc.ConnCo
|
||||
Timeout: streamrpc.Timeout{
|
||||
Progress: conf.Timeout,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
if err := srpcConf.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return srpcConf, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user