neitomic / doh-server

An implementation of DNS server which supports DNS over HTTPS
1 stars 1 forks source link

Since the Socket is cached, what happens if the server send the response after the timeout? #20

Open neitomic opened 6 days ago

neitomic commented 6 days ago

https://github.com/neitomic/doh-server/blob/ec14e60c22a06f4774cb89f894fb05dcfe0981c7/src/dns/mod.rs#L46

Since the Socket is cached, what happens if the server send the response after the timeout?

Related to #20

neitomic commented 6 days ago

@sonhmai noticed this after merged the timeout PR

sonhmai commented 6 days ago

Interesting question!

neitomic commented 6 days ago

The UDP socket is stateless and it's still open, the server can still send the response back after some time, so there will be a problem if another request reuse the socket and read the response of the old request.

sonhmai commented 6 days ago

The UDP socket is stateless and it's still open, the server can still send the response back after some time, so there will be a problem if another request reuse the socket and read the response of the old request.

good observation, can be a real problem if it happens that way 🤔