-
-
Notifications
You must be signed in to change notification settings - Fork 431
What's the possible reason for server sending CONNECTION_REFUSED on handshake? #2234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Are you talking about a Quinn server? It looks like this could happen for one of three reasons:
If this is your own server, I'm guessing it's (2) and you're forgetting to actively ignore or refuse connections that are coming in. |
Yes, it's indeed an Quinn server, I have create an Quinn listener like this, what could be missing? pub struct QAcceptor {
ep: quinn::Endpoint,
incoming: FuturesUnordered<quinn::IncomingFuture>,
}
impl QAcceptor {
pub async fn accept<T: Sync + Send>(&mut self) -> anyhow::Result<QConn<T>>
where
T: QuicMsgType,
{
loop {
tokio::select! {
accepted = self.ep.accept() => {
if let Some(incoming) = accepted {
info!("accept: {}", incoming.remote_address());
self.incoming.push(incoming.into_future());
}
}
Some(conn) = self.incoming.next() => {
let conn = match conn {
Ok(x) => x,
Err(err) => {
error!("accept incoming error: {err:?}");
continue;
}
};
return Ok(QConn::new(conn, false).await?);
},
}
}
}
} |
If I'm not mistaken, the |
From what I see calling impl IntoFuture for Incoming {
type Output = Result<Connection, ConnectionError>;
type IntoFuture = IncomingFuture;
fn into_future(self) -> Self::IntoFuture {
IncomingFuture(self.accept())
}
} |
Okay, then I'm not sure what's going on and you might want to dig in. |
Quite confused. I have been using code like this for a long time, and nothing happened. Will switch to pub struct QAcceptor {
ep: quinn::Endpoint,
incoming: FuturesUnordered<quinn::Connecting>,
}
impl QAcceptor {
pub async fn accept<T: Sync + Send>(&mut self) -> anyhow::Result<QConn<T>>
where
T: QuicMsgType,
{
loop {
tokio::select! {
accepted = self.ep.accept() => {
if let Some(incoming) = accepted {
info!("accept: {}", incoming.remote_address());
let connecting = match incoming.accept() {
Ok(x) => x,
Err(err) => {
error!("accept incoming error: {}", err);
continue;
}
};
self.incoming.push(connecting);
}
}
Some(conn) = self.incoming.next() => {
let conn = match conn {
Ok(x) => x,
Err(err) => {
error!("accept incoming error: {err:?}");
continue;
}
};
return Ok(QConn::new(conn, false).await?);
},
}
}
}
} |
Everytime the client send a handshake the server responde with CONNECTION_REFUSED error.
The text was updated successfully, but these errors were encountered: