coupled socket shutdown with epp logout
This commit is contained in:
parent
e07eba2de2
commit
c5e467b023
|
@ -96,7 +96,7 @@ async fn main() {
|
|||
.iter()
|
||||
.for_each(|chk| println!("Domain: {}, Available: {}", chk.domain.name, chk.domain.available));
|
||||
|
||||
client.close().await.unwrap();
|
||||
client.logout().await.unwrap();
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ repository = "https://github.com/masalachai/epp-client"
|
|||
epp-client-macros = "0.1" # { path = "../epp-client-macros" }
|
||||
bytes = "1"
|
||||
chrono = "0.4"
|
||||
futures = "0.3"
|
||||
env_logger = "0.9"
|
||||
log = "0.4"
|
||||
quick-xml = { version = "0.22", features = [ "serialize" ] }
|
||||
|
|
|
@ -184,12 +184,10 @@ impl EppClient {
|
|||
let client_tr_id = generate_client_tr_id(&self.credentials.0).unwrap();
|
||||
let epp_logout = EppLogout::new(client_tr_id.as_str());
|
||||
|
||||
self.transact::<_, EppLogoutResponse>(&epp_logout).await
|
||||
}
|
||||
let response = self.transact::<_, EppLogoutResponse>(&epp_logout).await?;
|
||||
|
||||
pub async fn close(&mut self) -> Result<(), error::Error> {
|
||||
self.logout().await?;
|
||||
self.connection.shutdown().await?;
|
||||
|
||||
Ok(self.connection.close().await?)
|
||||
Ok(response)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,8 +127,8 @@ impl EppConnection {
|
|||
Ok(response)
|
||||
}
|
||||
|
||||
/// Closes the socket
|
||||
pub async fn close(&mut self) -> Result<(), Box<dyn Error>> {
|
||||
/// Closes the socket and shuts the connection
|
||||
pub async fn shutdown(&mut self) -> Result<(), Box<dyn Error>> {
|
||||
info!("{}: Closing connection", self.registry);
|
||||
|
||||
self.stream.writer.shutdown().await?;
|
||||
|
|
|
@ -52,7 +52,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppContactCheck = EppObject<Command<ContactCheck>>;
|
||||
|
|
|
@ -69,7 +69,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppContactCreate = EppObject<Command<ContactCreate>>;
|
||||
|
|
|
@ -53,7 +53,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppContactDelete = EppObject<Command<ContactDelete>>;
|
||||
|
|
|
@ -55,7 +55,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppContactInfo = EppObject<Command<ContactInfo>>;
|
||||
|
|
|
@ -65,7 +65,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppContactUpdate = EppObject<Command<ContactUpdate>>;
|
||||
|
|
|
@ -53,7 +53,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppDomainCheck = EppObject<Command<DomainCheck>>;
|
||||
|
|
|
@ -73,7 +73,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppDomainCreate = EppObject<Command<DomainCreate>>;
|
||||
|
|
|
@ -50,7 +50,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppDomainDelete = EppObject<Command<DomainDelete>>;
|
||||
|
|
|
@ -50,7 +50,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppDomainInfo = EppObject<Command<DomainInfo>>;
|
||||
|
|
|
@ -57,7 +57,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppDomainRenew = EppObject<Command<DomainRenew>>;
|
||||
|
|
|
@ -80,7 +80,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppDomainRgpRestoreReport =
|
||||
|
|
|
@ -57,7 +57,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppDomainRgpRestoreRequest =
|
||||
|
|
|
@ -53,7 +53,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppDomainTransferRequest = EppObject<Command<DomainTransfer>>;
|
||||
|
@ -103,7 +103,7 @@ pub type EppDomainTransferRequest = EppObject<Command<DomainTransfer>>;
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppDomainTransferApprove = EppObject<Command<DomainTransfer>>;
|
||||
|
@ -153,7 +153,7 @@ pub type EppDomainTransferApprove = EppObject<Command<DomainTransfer>>;
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppDomainTransferReject = EppObject<Command<DomainTransfer>>;
|
||||
|
@ -203,7 +203,7 @@ pub type EppDomainTransferReject = EppObject<Command<DomainTransfer>>;
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppDomainTransferCancel = EppObject<Command<DomainTransfer>>;
|
||||
|
@ -253,7 +253,7 @@ pub type EppDomainTransferCancel = EppObject<Command<DomainTransfer>>;
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppDomainTransferQuery = EppObject<Command<DomainTransfer>>;
|
||||
|
|
|
@ -77,7 +77,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppDomainUpdate = EppObject<Command<DomainUpdate<HostObjList>>>;
|
||||
|
|
|
@ -53,7 +53,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppHostCheck = EppObject<Command<HostCheck>>;
|
||||
|
|
|
@ -58,7 +58,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppHostCreate = EppObject<Command<HostCreate>>;
|
||||
|
|
|
@ -50,7 +50,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppHostDelete = EppObject<Command<HostDelete>>;
|
||||
|
|
|
@ -50,7 +50,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppHostInfo = EppObject<Command<HostInfo>>;
|
||||
|
|
|
@ -74,7 +74,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppHostUpdate = EppObject<Command<HostUpdate>>;
|
||||
|
|
|
@ -48,7 +48,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppMessageAck = EppObject<Command<MessageAck>>;
|
||||
|
|
|
@ -49,7 +49,7 @@ use serde::{Deserialize, Serialize};
|
|||
///
|
||||
/// println!("{:?}", response);
|
||||
///
|
||||
/// client.close().await.unwrap();
|
||||
/// client.logout().await.unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
pub type EppMessagePoll = EppObject<Command<MessagePoll>>;
|
||||
|
|
Loading…
Reference in New Issue