Skip to content

Commit 8be4926

Browse files
author
Chao Xu
committed
remove duplicate fields in ac and rac. Only rac has a copy now
1 parent 26b4ab0 commit 8be4926

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

pkg/agent/agentclient/client.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ type AgentClient struct {
3333
nextConnID int64
3434
connContext map[int64]*connContext
3535

36-
stream *RedialableAgentClient
37-
serverID string // the proxy server this client connects to
38-
serverCount int // number of proxy servers, 1 if server is not HA.
39-
stopCh <-chan struct{}
36+
stream *RedialableAgentClient
37+
stopCh <-chan struct{}
4038
}
4139

4240
func newAgentClient(address, agentID string, cs *ClientSet, opts ...grpc.DialOption) (*AgentClient, error) {
@@ -51,8 +49,6 @@ func newAgentClientWithRedialableAgentClient(rac *RedialableAgentClient) *AgentC
5149
return &AgentClient{
5250
connContext: make(map[int64]*connContext),
5351
stream: rac,
54-
serverID: rac.serverID,
55-
serverCount: rac.serverCount,
5652
stopCh: rac.stopCh,
5753
}
5854
}
@@ -88,7 +84,7 @@ func (c *connContext) cleanup() {
8884
// The requests include things like opening a connection to a server,
8985
// streaming data and close the connection.
9086
func (a *AgentClient) Serve() {
91-
klog.Infof("Start serving for serverID %s", a.serverID)
87+
klog.Infof("Start serving for serverID %s", a.stream.serverID)
9288
go a.stream.probe()
9389
for {
9490
select {

pkg/agent/agentclient/clientset.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ func (cs *ClientSet) sync() {
138138
klog.Error(err)
139139
continue
140140
}
141-
cs.serverCount = c.serverCount
142-
if err := cs.AddClient(c.serverID, c); err != nil {
141+
cs.serverCount = c.stream.serverCount
142+
if err := cs.AddClient(c.stream.serverID, c); err != nil {
143143
klog.Infof("closing connection: %v", err)
144144
c.Close()
145145
continue
146146
}
147-
klog.Infof("sync added client connecting to proxy server %s", c.serverID)
147+
klog.Infof("sync added client connecting to proxy server %s", c.stream.serverID)
148148
go c.Serve()
149149
}
150150
}

0 commit comments

Comments
 (0)