@@ -466,7 +466,10 @@ cdef class Protocol(BaseProtocol):
466466 cdef int _reset(self , Message message) except - 1 :
467467 cdef uint8_t marker_type, packet_type
468468
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
470473 while True :
471474 packet_type = self ._read_buf._current_packet.packet_type
472475 if packet_type == TNS_PACKET_TYPE_MARKER:
@@ -476,12 +479,11 @@ cdef class Protocol(BaseProtocol):
476479 break
477480 self ._read_buf.wait_for_packets_sync()
478481
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)
485487 while packet_type == TNS_PACKET_TYPE_MARKER:
486488 self ._read_buf.wait_for_packets_sync()
487489 packet_type = self ._read_buf._current_packet.packet_type
@@ -842,7 +844,10 @@ cdef class BaseAsyncProtocol(BaseProtocol):
842844 async def _reset(self ):
843845 cdef uint8_t marker_type, packet_type
844846
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
846851 while True :
847852 packet_type = self ._read_buf._current_packet.packet_type
848853 if packet_type == TNS_PACKET_TYPE_MARKER:
@@ -852,12 +857,11 @@ cdef class BaseAsyncProtocol(BaseProtocol):
852857 break
853858 await self ._read_buf.wait_for_packets_async()
854859
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)
861865 while packet_type == TNS_PACKET_TYPE_MARKER:
862866 await self ._read_buf.wait_for_packets_async()
863867 packet_type = self ._read_buf._current_packet.packet_type
0 commit comments