@@ -146,7 +146,7 @@ func (c *Client) handleResponse() {
146
146
}
147
147
}
148
148
149
- func (c * Client ) handleSaslHandshakeResponse (streamingRes * ReaderProtocol , r * bufio.Reader ) interface {} {
149
+ func (c * Client ) handleSaslHandshakeResponse (streamingRes * ReaderProtocol , r * bufio.Reader ) {
150
150
streamingRes .CorrelationId , _ = readUInt (r )
151
151
streamingRes .ResponseCode = uShortExtractResponseCode (readUShort (r ))
152
152
mechanismsCount , _ := readUInt (r )
@@ -158,12 +158,11 @@ func (c *Client) handleSaslHandshakeResponse(streamingRes *ReaderProtocol, r *bu
158
158
159
159
res , err := c .coordinator .GetResponseById (streamingRes .CorrelationId )
160
160
if err != nil {
161
- // TODO handle response
162
- return err
161
+ logErrorCommand ( err , "handleSaslHandshakeResponse" )
162
+ return
163
163
}
164
- res .data <- mechanisms
165
164
166
- return mechanisms
165
+ res . data <- mechanisms
167
166
}
168
167
169
168
func (c * Client ) handlePeerProperties (readProtocol * ReaderProtocol , r * bufio.Reader ) {
@@ -178,7 +177,11 @@ func (c *Client) handlePeerProperties(readProtocol *ReaderProtocol, r *bufio.Rea
178
177
serverProperties [key ] = value
179
178
}
180
179
res , err := c .coordinator .GetResponseById (readProtocol .CorrelationId )
181
- logErrorCommand (err , "handlePeerProperties" )
180
+ if err != nil {
181
+ logErrorCommand (err , "handlePeerProperties" )
182
+ return
183
+ }
184
+
182
185
res .code <- Code {id : readProtocol .ResponseCode }
183
186
res .data <- serverProperties
184
187
@@ -210,7 +213,11 @@ func (c *Client) handleGenericResponse(readProtocol *ReaderProtocol, r *bufio.Re
210
213
readProtocol .CorrelationId , _ = readUInt (r )
211
214
readProtocol .ResponseCode = uShortExtractResponseCode (readUShort (r ))
212
215
res , err := c .coordinator .GetResponseById (readProtocol .CorrelationId )
213
- logErrorCommand (err , "handleGenericResponse" )
216
+ if err != nil {
217
+ logErrorCommand (err , "handleGenericResponse" )
218
+ return
219
+ }
220
+
214
221
res .code <- Code {id : readProtocol .ResponseCode }
215
222
}
216
223
@@ -237,7 +244,11 @@ func (c *Client) commandOpen(readProtocol *ReaderProtocol, r *bufio.Reader) {
237
244
}
238
245
239
246
res , err := c .coordinator .GetResponseById (readProtocol .CorrelationId )
240
- logErrorCommand (err , "commandOpen" )
247
+ if err != nil {
248
+ logErrorCommand (err , "commandOpen" )
249
+ return
250
+ }
251
+
241
252
res .code <- Code {id : readProtocol .ResponseCode }
242
253
res .data <- clientProperties
243
254
@@ -277,7 +288,11 @@ func (c *Client) queryPublisherSequenceFrameHandler(readProtocol *ReaderProtocol
277
288
readProtocol .ResponseCode = uShortExtractResponseCode (readUShort (r ))
278
289
sequence := readInt64 (r )
279
290
res , err := c .coordinator .GetResponseById (readProtocol .CorrelationId )
280
- logErrorCommand (err , "queryPublisherSequenceFrameHandler" )
291
+ if err != nil {
292
+ logErrorCommand (err , "queryPublisherSequenceFrameHandler" )
293
+ return
294
+ }
295
+
281
296
res .code <- Code {id : readProtocol .ResponseCode }
282
297
res .data <- sequence
283
298
}
@@ -458,7 +473,11 @@ func (c *Client) queryOffsetFrameHandler(readProtocol *ReaderProtocol,
458
473
c .handleGenericResponse (readProtocol , r )
459
474
offset := readInt64 (r )
460
475
res , err := c .coordinator .GetResponseById (readProtocol .CorrelationId )
461
- logErrorCommand (err , "queryOffsetFrameHandler" )
476
+ if err != nil {
477
+ logErrorCommand (err , "queryOffsetFrameHandler" )
478
+ return
479
+ }
480
+
462
481
res .data <- offset
463
482
}
464
483
@@ -516,7 +535,11 @@ func (c *Client) streamStatusFrameHandler(readProtocol *ReaderProtocol,
516
535
streamStatus [key ] = value
517
536
}
518
537
res , err := c .coordinator .GetResponseById (readProtocol .CorrelationId )
519
- logErrorCommand (err , "streamStatusFrameHandler" )
538
+ if err != nil {
539
+ logErrorCommand (err , "streamStatusFrameHandler" )
540
+ return
541
+ }
542
+
520
543
res .code <- Code {id : readProtocol .ResponseCode }
521
544
res .data <- streamStatus
522
545
@@ -553,7 +576,10 @@ func (c *Client) metadataFrameHandler(readProtocol *ReaderProtocol,
553
576
}
554
577
555
578
res , err := c .coordinator .GetResponseById (readProtocol .CorrelationId )
556
- logErrorCommand (err , "metadataFrameHandler" )
579
+ if err != nil {
580
+ logErrorCommand (err , "metadataFrameHandler" )
581
+ return
582
+ }
557
583
558
584
res .code <- Code {id : readProtocol .ResponseCode }
559
585
res .data <- streamsMetadata
@@ -612,7 +638,11 @@ func (c *Client) handleQueryPartitions(readProtocol *ReaderProtocol, r *bufio.Re
612
638
partitions = append (partitions , partition )
613
639
}
614
640
res , err := c .coordinator .GetResponseById (readProtocol .CorrelationId )
615
- logErrorCommand (err , "handleQueryPartitions" )
641
+ if err != nil {
642
+ logErrorCommand (err , "handleQueryPartitions" )
643
+ return
644
+ }
645
+
616
646
res .code <- Code {id : readProtocol .ResponseCode }
617
647
res .data <- partitions
618
648
}
@@ -629,7 +659,11 @@ func (c *Client) handleQueryRoute(readProtocol *ReaderProtocol, r *bufio.Reader)
629
659
}
630
660
631
661
res , err := c .coordinator .GetResponseById (readProtocol .CorrelationId )
632
- logErrorCommand (err , "handleQueryRoute" )
662
+ if err != nil {
663
+ logErrorCommand (err , "handleQueryRoute" )
664
+ return
665
+ }
666
+
633
667
res .code <- Code {id : readProtocol .ResponseCode }
634
668
res .data <- routes
635
669
}
@@ -646,7 +680,11 @@ func (c *Client) handleExchangeVersionResponse(readProtocol *ReaderProtocol, r *
646
680
commands = append (commands , newCommandVersionResponse (minVersion , maxVersion , commandKey ))
647
681
}
648
682
res , err := c .coordinator .GetResponseById (readProtocol .CorrelationId )
649
- logErrorCommand (err , "handleExchangeVersionResponse" )
683
+ if err != nil {
684
+ logErrorCommand (err , "handleExchangeVersionResponse" )
685
+ return
686
+ }
687
+
650
688
res .code <- Code {id : readProtocol .ResponseCode }
651
689
res .data <- commands
652
690
}
0 commit comments