ndt-server
ndt-server copied to clipboard
ndt7: see if we can close *os.File on UPGRADE error
Currently, the code lets the cache eviction mechanism handle closing a *os.File
that is bound to a socket for which the WebSocket UPGRADE failed. We can probably do better, by obtaining the *os.File
and closing it early, but that will require to hijack the HTTP connection.
If we knew we were using http/1.1
for sure, we could just write a reply. The possibility of being serving a http2
request makes the whole matter slightly more complex.
This issue is about double thinking about whether this is actually an issue, and, if so, implementing a low-complexity fix to improve the situation. It may well be that it's fine to just let the cache take care of the cached *os.File
. However, it remains to understand whether keeping the *os.File
cached also keeps the TCP connection open for some more time.
We are not too worried about this. I'm unassigning myself for now.