Skip to content

Commit 8aa2ec4

Browse files
committed
pass a not nil context
1 parent 6267bc3 commit 8aa2ec4

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

pulsar/internal/connection.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -493,15 +493,6 @@ func (c *connection) WriteData(ctx context.Context, data Buffer) {
493493

494494
func (c *connection) internalWriteData(ctx context.Context, data Buffer) {
495495
c.log.Debug("Write data: ", data.ReadableBytes())
496-
if ctx == nil {
497-
if _, err := c.cnx.Write(data.ReadableSlice()); err != nil {
498-
c.log.WithError(err).Warn("Failed to write on connection")
499-
c.Close()
500-
}
501-
502-
return
503-
}
504-
505496
select {
506497
case <-ctx.Done():
507498
return
@@ -534,7 +525,7 @@ func (c *connection) writeCommand(cmd *pb.BaseCommand) {
534525
}
535526

536527
c.writeBuffer.WrittenBytes(cmdSize)
537-
c.internalWriteData(nil, c.writeBuffer)
528+
c.internalWriteData(context.Background(), c.writeBuffer)
538529
}
539530

540531
func (c *connection) receivedCommand(cmd *pb.BaseCommand, headersAndPayload Buffer) {

0 commit comments

Comments
 (0)