File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
sqlx-core/src/mssql/connection Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -95,12 +95,16 @@ impl MssqlStream {
9595 // writes the packet out to the write buffer, splitting it if neccessary, and flushing TDS packets one at a time
9696 pub ( crate ) async fn flush ( & mut self ) -> Result < ( ) , Error > {
9797 // flush self.max_packet_size bytes at a time
98- while self . inner . wbuf . len ( ) > self . max_packet_size {
98+ if self . inner . wbuf . len ( ) > self . max_packet_size {
9999 let rest = self . inner . wbuf . split_off ( self . max_packet_size ) ;
100100 self . inner . flush ( ) . await ?;
101- self . inner . wbuf = rest;
101+ for chunk in rest. chunks ( self . max_packet_size ) {
102+ self . inner . wbuf . extend_from_slice ( chunk) ;
103+ self . inner . flush ( ) . await ?;
104+ }
105+ } else {
106+ self . inner . flush ( ) . await ?;
102107 }
103- self . inner . flush ( ) . await ?;
104108 Ok ( ( ) )
105109 }
106110
You can’t perform that action at this time.
0 commit comments