@@ -466,7 +466,10 @@ cdef class Protocol(BaseProtocol):
466
466
cdef int _reset(self , Message message) except - 1 :
467
467
cdef uint8_t marker_type, packet_type
468
468
469
- # read and discard all packets until a marker packet is received
469
+ # send reset marker
470
+ self ._send_marker(self ._write_buf, TNS_MARKER_TYPE_RESET)
471
+
472
+ # read and discard all packets until a reset marker is received
470
473
while True :
471
474
packet_type = self ._read_buf._current_packet.packet_type
472
475
if packet_type == TNS_PACKET_TYPE_MARKER:
@@ -476,12 +479,11 @@ cdef class Protocol(BaseProtocol):
476
479
break
477
480
self ._read_buf.wait_for_packets_sync()
478
481
479
- # send reset marker and then read error packet; first skip as many
480
- # marker packets as may be sent by the server; if the server doesn't
481
- # handle out-of-band breaks properly, some quit immediately and others
482
- # send multiple reset markers (this addresses both situations without
483
- # resulting in strange errors)
484
- self ._send_marker(self ._write_buf, TNS_MARKER_TYPE_RESET)
482
+ # read error packet; first skip as many marker packets as may be sent
483
+ # by the server; if the server doesn't handle out-of-band breaks
484
+ # properly, some quit immediately and others send multiple reset
485
+ # markers (this addresses both situations without resulting in strange
486
+ # errors)
485
487
while packet_type == TNS_PACKET_TYPE_MARKER:
486
488
self ._read_buf.wait_for_packets_sync()
487
489
packet_type = self ._read_buf._current_packet.packet_type
@@ -842,7 +844,10 @@ cdef class BaseAsyncProtocol(BaseProtocol):
842
844
async def _reset(self ):
843
845
cdef uint8_t marker_type, packet_type
844
846
845
- # read and discard all packets until a marker packet is received
847
+ # send reset marker
848
+ self ._send_marker(self ._write_buf, TNS_MARKER_TYPE_RESET)
849
+
850
+ # read and discard all packets until a reset marker is received
846
851
while True :
847
852
packet_type = self ._read_buf._current_packet.packet_type
848
853
if packet_type == TNS_PACKET_TYPE_MARKER:
@@ -852,12 +857,11 @@ cdef class BaseAsyncProtocol(BaseProtocol):
852
857
break
853
858
await self ._read_buf.wait_for_packets_async()
854
859
855
- # send reset marker and then read error packet; first skip as many
856
- # marker packets as may be sent by the server; if the server doesn't
857
- # handle out-of-band breaks properly, some quit immediately and others
858
- # send multiple reset markers (this addresses both situations without
859
- # resulting in strange errors)
860
- self ._send_marker(self ._write_buf, TNS_MARKER_TYPE_RESET)
860
+ # read error packet; first skip as many marker packets as may be sent
861
+ # by the server; if the server doesn't handle out-of-band breaks
862
+ # properly, some quit immediately and others send multiple reset
863
+ # markers (this addresses both situations without resulting in strange
864
+ # errors)
861
865
while packet_type == TNS_PACKET_TYPE_MARKER:
862
866
await self ._read_buf.wait_for_packets_async()
863
867
packet_type = self ._read_buf._current_packet.packet_type
0 commit comments