Skip to content

Commit

Permalink
Update protocol PingInterval unit to seconds
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
  • Loading branch information
kozlovic committed May 24, 2018
1 parent f2795b6 commit ca14b1e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 46 deletions.
14 changes: 7 additions & 7 deletions server/server_clients_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ func testClientPings(t *testing.T, s *StanServer) {
HeartbeatInbox: hbInbox,
ConnID: []byte(nuid.Next()),
Protocol: protocolOne,
PingInterval: int64(time.Second),
PingInterval: 1,
PingMaxOut: 3,
}
firstConnID := creq.ConnID
Expand All @@ -512,7 +512,7 @@ func testClientPings(t *testing.T, s *StanServer) {
if cresp.Error != "" {
t.Fatalf("Error on connect: %v", cresp.Error)
}
if cresp.Protocol != protocolOne || cresp.PingRequests == "" || cresp.PingInterval != int64(time.Second) || cresp.PingMaxOut != 3 {
if cresp.Protocol != protocolOne || cresp.PingRequests == "" || cresp.PingInterval != 1 || cresp.PingMaxOut != 3 {
t.Fatalf("Unexpected response: %#v", cresp)
}

Expand Down Expand Up @@ -596,7 +596,7 @@ func testClientPings(t *testing.T, s *StanServer) {
HeartbeatInbox: nats.NewInbox(),
ConnID: []byte(nuid.Next()),
Protocol: protocolOne,
PingInterval: int64(time.Second),
PingInterval: 1,
PingMaxOut: 3,
}
creqBytes, _ = creq.Marshal()
Expand Down Expand Up @@ -691,7 +691,7 @@ func TestPersistentStoreRecoverClientInfo(t *testing.T) {
HeartbeatInbox: nats.NewInbox(),
ConnID: []byte(nuid.Next()),
Protocol: protocolOne,
PingInterval: int64(time.Second),
PingInterval: 1,
PingMaxOut: 3,
}
creqBytes, _ := creq.Marshal()
Expand All @@ -706,7 +706,7 @@ func TestPersistentStoreRecoverClientInfo(t *testing.T) {
if cresp.Error != "" {
t.Fatalf("Error on connect: %v", cresp.Error)
}
if cresp.Protocol != protocolOne || cresp.PingRequests == "" || cresp.PingInterval != int64(time.Second) || cresp.PingMaxOut != 3 {
if cresp.Protocol != protocolOne || cresp.PingRequests == "" || cresp.PingInterval != 1 || cresp.PingMaxOut != 3 {
t.Fatalf("Unexpected response: %#v", cresp)
}

Expand All @@ -732,8 +732,8 @@ func TestPersistentStoreRecoverClientInfo(t *testing.T) {
if string(cid) != string(creq.ConnID) {
t.Fatalf("Recovered ConnID should be %s, got %s", creq.ConnID, cid)
}
if pi != int64(time.Second) {
t.Fatalf("Recovered ping interval should be %v, got %v", time.Second, time.Duration(pi))
if pi != 1 {
t.Fatalf("Recovered ping interval should be 1, got %v", time.Duration(pi))
}
if pmo != 3 {
t.Fatalf("Recovered ping max out should be 3, got %v", pmo)
Expand Down
10 changes: 5 additions & 5 deletions spb/protocol.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spb/protocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ message ClientInfo {
string HbInbox = 2; // The inbox heartbeats are sent to
bytes ConnID = 3; // Connection ID (no connection should ever have the same)
int32 Protocol = 4; // Protocol the client is at
int64 PingInterval = 5; // Interval at which the client is sending PINGs (time.Duration so in nanoseconds)
int32 PingInterval = 5; // Interval at which the client is sending PINGs (expressed in seconds)
int32 PingMaxOut = 6; // Number of PINGs without response before the connection can be considered lost
}

Expand Down
64 changes: 32 additions & 32 deletions vendor/github.com/nats-io/go-nats-streaming/pb/protocol.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
"importpath": "github.com/nats-io/go-nats-streaming",
"repository": "https://github.com/nats-io/go-nats-streaming",
"vcs": "git",
"revision": "ce89b3a81fae978b19fb2c96da393c064cdf6d88",
"revision": "c6a960c17758f63fdbbb01d26f77f28e501b528c",
"branch": "master",
"notests": true
},
Expand Down

0 comments on commit ca14b1e

Please sign in to comment.