1
0

reset on Connect to immediately close streams

This commit is contained in:
EAimTY 2023-05-20 20:46:09 +09:00
parent e264448ff0
commit 1278cd7398

View File

@ -5,6 +5,7 @@ use bytes::{BufMut, Bytes};
use futures_util::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; use futures_util::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
use quinn::{ use quinn::{
Connection as QuinnConnection, ConnectionError, RecvStream, SendDatagramError, SendStream, Connection as QuinnConnection, ConnectionError, RecvStream, SendDatagramError, SendStream,
UnknownStream, VarInt,
}; };
use std::{ use std::{
fmt::{Debug, Formatter, Result as FmtResult}, fmt::{Debug, Formatter, Result as FmtResult},
@ -411,6 +412,15 @@ impl Connect {
Side::Server(model) => model.addr(), Side::Server(model) => model.addr(),
} }
} }
pub fn reset(
&mut self,
error_code: VarInt,
) -> (Result<(), UnknownStream>, Result<(), UnknownStream>) {
let send_res = self.send.reset(error_code);
let recv_res = self.recv.stop(error_code);
(send_res, recv_res)
}
} }
impl AsyncRead for Connect { impl AsyncRead for Connect {