aboutsummaryrefslogtreecommitdiff
path: root/src/proto.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/proto.rs')
-rw-r--r--src/proto.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/proto.rs b/src/proto.rs
index 1fd0929..39fa0d6 100644
--- a/src/proto.rs
+++ b/src/proto.rs
@@ -491,6 +491,22 @@ impl<O: ProtocolOption> NegotiationProtocol<O> {
self.lower_status_rx.clone()
}
+ /// Sends a Protocol-Reject for the specified protocol ID to the peer.
+ pub fn reject(&self, id: u16) {
+ if self.state != ProtocolState::Opened {
+ return;
+ }
+
+ self.output_tx
+ .send(Packet {
+ ty: PacketType::ProtocolReject,
+ options: Vec::default(),
+ rejected_code: PacketType::Unknown(0),
+ rejected_protocol: id,
+ })
+ .expect("output channel is closed");
+ }
+
fn timeout_positive(&mut self) -> Option<Packet<O>> {
match self.state {
ProtocolState::Initial