Skip to content

Commit f4d1c9b

Browse files
authored
fix: unblock channel for cni (#1667)
* implement select case * remove calls to tb.cancel() in telemetry.go
1 parent b6aaca6 commit f4d1c9b

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

telemetry/telemetry.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,8 @@ func (reportMgr *ReportManager) SendReport(tb *TelemetryBuffer) error {
111111
if tb != nil && tb.Connected {
112112
report, err = reportMgr.ReportToBytes()
113113
if err == nil {
114-
// If write fails, try to re-establish connections as server/client
115114
if _, err = tb.Write(report); err != nil {
116115
log.Printf("telemetry write failed:%v", err)
117-
tb.Cancel()
118116
}
119117
}
120118
}
@@ -124,7 +122,6 @@ func (reportMgr *ReportManager) SendReport(tb *TelemetryBuffer) error {
124122

125123
// ReportToBytes - returns the report bytes
126124
func (reportMgr *ReportManager) ReportToBytes() ([]byte, error) {
127-
128125
switch reportMgr.Report.(type) {
129126
case *CNIReport:
130127
case *AIMetric:
@@ -145,9 +142,8 @@ func SendCNIMetric(cniMetric *AIMetric, tb *TelemetryBuffer) error {
145142
reportMgr := &ReportManager{Report: cniMetric}
146143
report, err = reportMgr.ReportToBytes()
147144
if err == nil {
148-
// If write fails, try to re-establish connections as server/client
149145
if _, err = tb.Write(report); err != nil {
150-
tb.Cancel()
146+
log.Printf("Error writing to telemetry socket:%v", err)
151147
}
152148
}
153149
}
@@ -160,10 +156,8 @@ func SendCNIEvent(tb *TelemetryBuffer, report *CNIReport) {
160156
reportMgr := &ReportManager{Report: report}
161157
reportBytes, err := reportMgr.ReportToBytes()
162158
if err == nil {
163-
// If write fails, try to re-establish connections as server/client
164159
if _, err = tb.Write(reportBytes); err != nil {
165160
log.Printf("Error writing to telemetry socket:%v", err)
166-
tb.Cancel()
167161
}
168162
}
169163
}

0 commit comments

Comments
 (0)