Skip to content

Commit d368475

Browse files
committed
Add flush() to front-end messages
The PostgreSQL wire protocol has a "Flush" message, which can be used by the clients for long-lived connections. Add a flush() helper for it.
1 parent 97db777 commit d368475

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

postgres-protocol/src/message/frontend.rs

+6
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,12 @@ where
271271
})
272272
}
273273

274+
#[inline]
275+
pub fn flush(buf: &mut BytesMut) {
276+
buf.put_u8(b'H');
277+
write_body(buf, |_| Ok::<(), io::Error>(())).unwrap();
278+
}
279+
274280
#[inline]
275281
pub fn sync(buf: &mut BytesMut) {
276282
buf.put_u8(b'S');

0 commit comments

Comments
 (0)