mirror of
https://github.com/zrepl/zrepl.git
synced 2024-12-25 00:18:53 +01:00
23 lines
538 B
Go
23 lines
538 B
Go
|
package streamrpcconfig
|
||
|
|
||
|
import (
|
||
|
"github.com/problame/go-streamrpc"
|
||
|
"github.com/zrepl/zrepl/config"
|
||
|
)
|
||
|
|
||
|
func FromDaemonConfig(g *config.Global, in *config.RPCConfig) (*streamrpc.ConnConfig, error) {
|
||
|
conf := in
|
||
|
if conf == nil {
|
||
|
conf = g.RPC
|
||
|
}
|
||
|
return &streamrpc.ConnConfig{
|
||
|
RxHeaderMaxLen: conf.RxHeaderMaxLen,
|
||
|
RxStructuredMaxLen: conf.RxStructuredMaxLen,
|
||
|
RxStreamMaxChunkSize: conf.RxStreamChunkMaxLen,
|
||
|
TxChunkSize: conf.TxChunkSize,
|
||
|
Timeout: streamrpc.Timeout{
|
||
|
Progress: conf.Timeout,
|
||
|
},
|
||
|
}, nil
|
||
|
}
|