fix(network): expose missing members in facades (#468)
This commit is contained in:
parent
f4fd2600f1
commit
540a27db8e
1 changed files with 23 additions and 7 deletions
|
|
@ -190,7 +190,7 @@ pub struct PeerServer {
|
||||||
pub txsubmission: txsubmission::Server,
|
pub txsubmission: txsubmission::Server,
|
||||||
pub keepalive: keepalive::Server,
|
pub keepalive: keepalive::Server,
|
||||||
accepted_address: Option<SocketAddr>,
|
accepted_address: Option<SocketAddr>,
|
||||||
accepted_version: Option<u64>,
|
accepted_version: Option<(u64, n2n::VersionData)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PeerServer {
|
impl PeerServer {
|
||||||
|
|
@ -236,9 +236,9 @@ impl PeerServer {
|
||||||
.await
|
.await
|
||||||
.map_err(Error::HandshakeProtocol)?;
|
.map_err(Error::HandshakeProtocol)?;
|
||||||
|
|
||||||
if let Some((version, _)) = accepted_version {
|
if let Some((version, data)) = accepted_version {
|
||||||
client.accepted_address = Some(address);
|
client.accepted_address = Some(address);
|
||||||
client.accepted_version = Some(version);
|
client.accepted_version = Some((version, data));
|
||||||
Ok(client)
|
Ok(client)
|
||||||
} else {
|
} else {
|
||||||
client.abort().await;
|
client.abort().await;
|
||||||
|
|
@ -266,6 +266,14 @@ impl PeerServer {
|
||||||
&mut self.keepalive
|
&mut self.keepalive
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn accepted_address(&self) -> Option<&SocketAddr> {
|
||||||
|
self.accepted_address.as_ref()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn accepted_version(&self) -> Option<&(u64, n2n::VersionData)> {
|
||||||
|
self.accepted_version.as_ref()
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn abort(self) {
|
pub async fn abort(self) {
|
||||||
self.plexer.abort().await
|
self.plexer.abort().await
|
||||||
}
|
}
|
||||||
|
|
@ -406,10 +414,10 @@ impl NodeClient {
|
||||||
/// Server of N2C Ouroboros.
|
/// Server of N2C Ouroboros.
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub struct NodeServer {
|
pub struct NodeServer {
|
||||||
plexer: RunningPlexer,
|
pub plexer: RunningPlexer,
|
||||||
handshake: handshake::N2CServer,
|
pub handshake: handshake::N2CServer,
|
||||||
chainsync: chainsync::N2CServer,
|
pub chainsync: chainsync::N2CServer,
|
||||||
statequery: localstate::Server,
|
pub statequery: localstate::Server,
|
||||||
accepted_address: Option<UnixSocketAddr>,
|
accepted_address: Option<UnixSocketAddr>,
|
||||||
accpeted_version: Option<(VersionNumber, n2c::VersionData)>,
|
accpeted_version: Option<(VersionNumber, n2c::VersionData)>,
|
||||||
}
|
}
|
||||||
|
|
@ -474,6 +482,14 @@ impl NodeServer {
|
||||||
&mut self.statequery
|
&mut self.statequery
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn accepted_address(&self) -> Option<&UnixSocketAddr> {
|
||||||
|
self.accepted_address.as_ref()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn accepted_version(&self) -> Option<&(u64, n2c::VersionData)> {
|
||||||
|
self.accpeted_version.as_ref()
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn abort(self) {
|
pub async fn abort(self) {
|
||||||
self.plexer.abort().await
|
self.plexer.abort().await
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue