@@ -366,7 +366,7 @@ impl<B: MysqlShim<W>, R: Read, W: Write> MysqlIntermediary<B, R, W> {
366366 self . writer . flush ( ) ?;
367367
368368 {
369- let ( seq, handshake) = self . reader . next ( ) ?. ok_or_else ( || {
369+ let ( mut seq, handshake) = self . reader . next ( ) ?. ok_or_else ( || {
370370 io:: Error :: new (
371371 io:: ErrorKind :: ConnectionAborted ,
372372 "peer terminated connection" ,
@@ -409,6 +409,7 @@ impl<B: MysqlShim<W>, R: Read, W: Write> MysqlIntermediary<B, R, W> {
409409 && auth_response. is_empty ( )
410410 && handshake. auth_plugin != auth_plugin_expect. as_bytes ( )
411411 {
412+ self . writer . set_seq ( seq + 1 ) ;
412413 self . writer . write_all ( & [ 0xfe ] ) ?;
413414 self . writer . write_all ( auth_plugin_expect. as_bytes ( ) ) ?;
414415 self . writer . write_all ( & [ 0x00 ] ) ?;
@@ -417,13 +418,14 @@ impl<B: MysqlShim<W>, R: Read, W: Write> MysqlIntermediary<B, R, W> {
417418
418419 self . writer . flush ( ) ?;
419420 {
420- let ( _seq , auth_response_data) = self . reader . next ( ) ?. ok_or_else ( || {
421+ let ( rseq , auth_response_data) = self . reader . next ( ) ?. ok_or_else ( || {
421422 io:: Error :: new (
422423 io:: ErrorKind :: ConnectionAborted ,
423424 "peer terminated connection" ,
424425 )
425426 } ) ?;
426427
428+ seq = rseq;
427429 auth_response = auth_response_data. to_vec ( ) ;
428430 }
429431 }
0 commit comments