File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
sqlx-core/src/mssql/connection Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 11use std:: ops:: { Deref , DerefMut } ;
22
33use bytes:: { Bytes , BytesMut } ;
4- use sqlx_rt:: TcpStream ;
4+ use sqlx_rt:: { AsyncWriteExt , TcpStream } ;
55
66use crate :: error:: Error ;
77use crate :: ext:: ustr:: UStr ;
@@ -96,12 +96,11 @@ impl MssqlStream {
9696 pub ( crate ) async fn flush ( & mut self ) -> Result < ( ) , Error > {
9797 // flush self.max_packet_size bytes at a time
9898 if self . inner . wbuf . len ( ) > self . max_packet_size {
99- let rest = self . inner . wbuf . split_off ( self . max_packet_size ) ;
100- self . inner . flush ( ) . await ?;
101- for chunk in rest. chunks ( self . max_packet_size ) {
102- self . inner . wbuf . extend_from_slice ( chunk) ;
103- self . inner . flush ( ) . await ?;
99+ for chunk in self . inner . wbuf . chunks ( self . max_packet_size ) {
100+ self . inner . stream . write_all ( chunk) . await ?;
101+ self . inner . stream . flush ( ) . await ?;
104102 }
103+ self . inner . wbuf . clear ( ) ;
105104 } else {
106105 self . inner . flush ( ) . await ?;
107106 }
You can’t perform that action at this time.
0 commit comments