diff --git a/Gopkg.lock b/Gopkg.lock index 07b31e6..6684973 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -170,15 +170,15 @@ revision = "391d2c78c8404a9683d79f75dd24ab53040f89f7" [[projects]] - digest = "1:f6bc2d2f9c00737754ef87dba06c851458523fa382a61e1e2e5270c1f39a6622" + digest = "1:c2ba1c9dc003c15856e4529dac028cacba08ee8924300f058b3467cde9acf7a9" name = "github.com/problame/go-streamrpc" packages = [ ".", "internal/pdu", ] pruneopts = "" - revision = "a67d93db93b3dc8c2d6901a1b2183ff42dea8f7d" - version = "v0.3" + revision = "de6f6a4041c77f700f02d8fe749e54efa50811f7" + version = "v0.4" [[projects]] branch = "master" diff --git a/Gopkg.toml b/Gopkg.toml index b08613e..fe541e1 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -69,4 +69,4 @@ ignored = [ "github.com/inconshreveable/mousetrap" ] [[constraint]] name = "github.com/problame/go-streamrpc" - version = "0.3.0" + version = "0.4.0" diff --git a/config/config.go b/config/config.go index 08262a9..d661d4a 100644 --- a/config/config.go +++ b/config/config.go @@ -130,6 +130,8 @@ type RPCConfig struct { RxStructuredMaxLen uint32 `yaml:"rx_structured_max,optional,default=16777216"` RxStreamChunkMaxLen uint32 `yaml:"rx_stream_chunk_max,optional,default=16777216"` RxHeaderMaxLen uint32 `yaml:"rx_header_max,optional,default=40960"` + SendHeartbeatInterval time.Duration `yaml:"send_heartbeat_interval,optional,positive,default=5s"` + } type ConnectEnum struct { diff --git a/config/config_rpc_test.go b/config/config_rpc_test.go index e295752..f74581d 100644 --- a/config/config_rpc_test.go +++ b/config/config_rpc_test.go @@ -53,11 +53,24 @@ jobs: rpc: rx_structured_max: 0x2342 +- type: sink + name: "other_sink" + root_dataset: "pool2/backup_laptops" + serve: + type: tcp + listen: "192.168.122.189:8888" + clients: { + "10.23.42.23":"client1" + } + rpc: + send_heartbeat_interval: 10s + `) assert.Equal(t, 20*time.Second, conf.Jobs[0].Ret.(*PullJob).Connect.Ret.(*TCPConnect).RPC.Timeout) assert.Equal(t, uint32(0xabcd), conf.Jobs[1].Ret.(*PullJob).Connect.Ret.(*TCPConnect).RPC.TxChunkSize) assert.Equal(t, uint32(0x2342), conf.Jobs[2].Ret.(*SinkJob).Serve.Ret.(*TCPServe).RPC.RxStructuredMaxLen) + assert.Equal(t, 10*time.Second, conf.Jobs[3].Ret.(*SinkJob).Serve.Ret.(*TCPServe).RPC.SendHeartbeatInterval) defConf := RPCConfig{} Default(&defConf) assert.Equal(t, defConf.Timeout, conf.Global.RPC.Timeout) diff --git a/daemon/streamrpcconfig/streamrpcconfig.go b/daemon/streamrpcconfig/streamrpcconfig.go index 8dc64f6..da28d5d 100644 --- a/daemon/streamrpcconfig/streamrpcconfig.go +++ b/daemon/streamrpcconfig/streamrpcconfig.go @@ -15,9 +15,8 @@ func FromDaemonConfig(g *config.Global, in *config.RPCConfig) (*streamrpc.ConnCo RxStructuredMaxLen: conf.RxStructuredMaxLen, RxStreamMaxChunkSize: conf.RxStreamChunkMaxLen, TxChunkSize: conf.TxChunkSize, - Timeout: streamrpc.Timeout{ - Progress: conf.Timeout, - }, + Timeout: conf.Timeout, + SendHeartbeatInterval: conf.SendHeartbeatInterval, } if err := srpcConf.Validate(); err != nil { return nil, err