refactor: pull version into const
This commit is contained in:
parent
73e2cec4e0
commit
73b3ae8a1f
|
@ -10,14 +10,16 @@ use crate::{
|
|||
WsStream,
|
||||
};
|
||||
|
||||
const VERSION: u32 = 1;
|
||||
|
||||
pub async fn version(conn: &mut WsStream, number: u32, req: VersionRequest) -> Result<bool> {
|
||||
if req.version != 1 {
|
||||
if req.version != VERSION {
|
||||
send(conn, number, ErrorResponse::new(None, "unsupported version")).await?;
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
send(conn, number, VersionResponse {
|
||||
version: 1,
|
||||
version: VERSION,
|
||||
}).await?;
|
||||
|
||||
Ok(true)
|
||||
|
|
Loading…
Reference in New Issue