mirror of
https://github.com/zrepl/zrepl.git
synced 2025-06-12 04:47:36 +02:00
fixup 3d8e552c6aa5b134932c1839f812571a96c6870f: 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 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 {
|
type ClientFactory struct {
|
||||||
|
@ -10,7 +10,7 @@ func FromDaemonConfig(g *config.Global, in *config.RPCConfig) (*streamrpc.ConnCo
|
|||||||
if conf == nil {
|
if conf == nil {
|
||||||
conf = g.RPC
|
conf = g.RPC
|
||||||
}
|
}
|
||||||
return &streamrpc.ConnConfig{
|
srpcConf := &streamrpc.ConnConfig{
|
||||||
RxHeaderMaxLen: conf.RxHeaderMaxLen,
|
RxHeaderMaxLen: conf.RxHeaderMaxLen,
|
||||||
RxStructuredMaxLen: conf.RxStructuredMaxLen,
|
RxStructuredMaxLen: conf.RxStructuredMaxLen,
|
||||||
RxStreamMaxChunkSize: conf.RxStreamChunkMaxLen,
|
RxStreamMaxChunkSize: conf.RxStreamChunkMaxLen,
|
||||||
@ -18,5 +18,9 @@ func FromDaemonConfig(g *config.Global, in *config.RPCConfig) (*streamrpc.ConnCo
|
|||||||
Timeout: streamrpc.Timeout{
|
Timeout: streamrpc.Timeout{
|
||||||
Progress: conf.Timeout,
|
Progress: conf.Timeout,
|
||||||
},
|
},
|
||||||
}, nil
|
}
|
||||||
|
if err := srpcConf.Validate(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return srpcConf, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user