Hello! Why Socket::close or Socket::dispose are not suspend functions?
a
Aleksei Tirman [JB]
10/06/2022, 6:30 PM
Could you please explain why do need them as suspendable methods?
p
PHondogo
10/06/2022, 7:06 PM
Close function can do some networking (for example send reset packet or flush unsent bytes), so now this function is possible blocking. While send and receive are suspend. It is not 100% coroutine based communication.
PHondogo
10/06/2022, 7:51 PM
By the way, flush function also not suspend. Why?
a
Aleksei Tirman [JB]
10/06/2022, 7:55 PM
That’s probably because the
Closeable
interface has blocking
close
method. If you need to send a reset packet you can do it on a higher level.
Aleksei Tirman [JB]
10/06/2022, 7:56 PM
Since
close
is a low-level operation that should only close a socket.