Skip to content

Commit 1aa2e5f

Browse files
author
Chao Xu
committed
addressing comments
1 parent 8be4926 commit 1aa2e5f

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

cmd/agent/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (o *GrpcProxyAgentOptions) Print() {
102102
klog.Warningf("ProxyServerHost set to \"%s\".\n", o.proxyServerHost)
103103
klog.Warningf("ProxyServerPort set to %d.\n", o.proxyServerPort)
104104
klog.Warningf("AgentID set to %s.\n", o.agentID)
105-
klog.Warningf("SyncInterval set to %d.\n", o.syncInterval)
105+
klog.Warningf("SyncInterval set to %d seconds.\n", o.syncInterval)
106106
klog.Warningf("ProbeInterval set to %d.\n", o.probeInterval)
107107
klog.Warningf("ReconnectInterval set to %d.\n", o.reconnectInterval)
108108
}

pkg/agent/agentclient/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ func newAgentClientWithRedialableAgentClient(rac *RedialableAgentClient) *AgentC
5555

5656
// Close closes the underlying stream.
5757
func (c *AgentClient) Close() {
58+
if c.stream == nil {
59+
klog.Warning("Unexpected empty AgentClient.stream")
60+
return
61+
}
5862
c.stream.Close()
5963
}
6064

pkg/agent/agentclient/clientset.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The Kubernetes Authors.
2+
Copyright 2020 The Kubernetes Authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ import (
2929

3030
// ClientSet consists of clients connected to each instance of an HA proxy server.
3131
type ClientSet struct {
32-
mu sync.Mutex //protects the following
32+
mu sync.Mutex //protects the clients.
3333
clients map[string]*AgentClient // map between serverID and the client
3434
// connects to this server.
3535

pkg/agent/agentclient/stream.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,5 +365,8 @@ func (c *RedialableAgentClient) tryConnect() (connectResult, error) {
365365
}
366366

367367
func (c *RedialableAgentClient) Close() {
368+
if c.conn == nil {
369+
klog.Warning("Unexpected empty RedialableAgentClient.stream")
370+
}
368371
c.conn.Close()
369372
}

0 commit comments

Comments
 (0)