mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-12 07:52:55 +00:00
few more review fixes
This commit is contained in:
@@ -268,7 +268,8 @@ fn start_pageserver(conf: &'static PageServerConf) -> Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
// Check that we can bind to address before further initialization
|
||||
// Check that we can bind to address before starting threads to simplify shutdown
|
||||
// sequence if port is occupied.
|
||||
info!("Starting pageserver on {}", conf.listen_addr);
|
||||
let pageserver_listener = TcpListener::bind(conf.listen_addr.clone())?;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use anyhow::bail;
|
||||
use bytes::Bytes;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use zenith_utils::{
|
||||
postgres_backend::{self, PostgresBackend},
|
||||
postgres_backend::{self, query_from_cstring, PostgresBackend},
|
||||
pq_proto::{BeMessage, SINGLE_COL_ROWDESC},
|
||||
};
|
||||
|
||||
@@ -78,12 +78,7 @@ impl postgres_backend::Handler for MgmtHandler {
|
||||
pgb: &mut PostgresBackend,
|
||||
query_string: Bytes,
|
||||
) -> anyhow::Result<()> {
|
||||
let mut query_string = query_string.to_vec();
|
||||
if let Some(ch) = query_string.last() {
|
||||
if *ch == 0 {
|
||||
query_string.pop();
|
||||
}
|
||||
}
|
||||
let query_string = query_from_cstring(query_string);
|
||||
|
||||
println!("Got mgmt query: '{}'", std::str::from_utf8(&query_string)?);
|
||||
|
||||
|
||||
@@ -63,17 +63,15 @@ pub struct PostgresBackend {
|
||||
auth_type: AuthType,
|
||||
}
|
||||
|
||||
// TODO: call shutdown() manually.
|
||||
// into_smth() methods do not work with types implementing Drop
|
||||
|
||||
// // In replication.rs a separate thread is reading keepalives from the
|
||||
// // socket. When main one finishes, tell it to get down by shutdowning the
|
||||
// // socket.
|
||||
// impl Drop for PostgresBackend {
|
||||
// fn drop(&mut self) {
|
||||
// let _res = self.stream_out.shutdown(Shutdown::Both);
|
||||
// }
|
||||
// }
|
||||
pub fn query_from_cstring(query_string: Bytes) -> Vec<u8> {
|
||||
let mut query_string = query_string.to_vec();
|
||||
if let Some(ch) = query_string.last() {
|
||||
if *ch == 0 {
|
||||
query_string.pop();
|
||||
}
|
||||
}
|
||||
query_string
|
||||
}
|
||||
|
||||
impl PostgresBackend {
|
||||
pub fn new(socket: TcpStream, auth_type: AuthType) -> Result<Self, std::io::Error> {
|
||||
|
||||
Reference in New Issue
Block a user