mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 17:15:31 +00:00
rename enum option
This commit is contained in:
parent
653960c1ab
commit
1dfaf68267
2 changed files with 4 additions and 4 deletions
|
|
@ -23,7 +23,7 @@ impl Connection {
|
||||||
server_identity: Option<NetworkAddress>,
|
server_identity: Option<NetworkAddress>,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
if socket_connection.is_closed() {
|
if socket_connection.is_closed() {
|
||||||
return Err(Error::SocketConnectionClosed);
|
return Err(Error::Closed);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
|
|
@ -118,7 +118,7 @@ pub fn new_tls_client_connection(
|
||||||
server_identity: Option<&NetworkAddress>,
|
server_identity: Option<&NetworkAddress>,
|
||||||
) -> Result<TlsClientConnection, Error> {
|
) -> Result<TlsClientConnection, Error> {
|
||||||
if socket_connection.is_closed() {
|
if socket_connection.is_closed() {
|
||||||
return Err(Error::SocketConnectionClosed);
|
return Err(Error::Closed);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#the-use-of-tls
|
// https://geminiprotocol.net/docs/protocol-specification.gmi#the-use-of-tls
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,19 @@ use std::fmt::{Display, Formatter, Result};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
|
Closed,
|
||||||
Rehandshake(glib::Error),
|
Rehandshake(glib::Error),
|
||||||
SocketConnection(glib::Error),
|
SocketConnection(glib::Error),
|
||||||
SocketConnectionClosed,
|
|
||||||
TlsClientConnection(glib::Error),
|
TlsClientConnection(glib::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Error {
|
impl Display for Error {
|
||||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||||
match self {
|
match self {
|
||||||
|
Self::Closed => write!(f, "Connection closed"),
|
||||||
Self::Rehandshake(e) => {
|
Self::Rehandshake(e) => {
|
||||||
write!(f, "Rehandshake error: {e}")
|
write!(f, "Rehandshake error: {e}")
|
||||||
}
|
}
|
||||||
Self::SocketConnectionClosed => write!(f, "Socket connection closed"),
|
|
||||||
Self::SocketConnection(e) => {
|
Self::SocketConnection(e) => {
|
||||||
write!(f, "Socket connection error: {e}")
|
write!(f, "Socket connection error: {e}")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue