MM-34000: Use non-epoll mode for TLS connections (#17172)
* MM-34000: Use non-epoll mode for TLS connections A *crypto/tls.Conn does not expose the underlying TCP connection or even a File method to get the underlying file descriptor like the way a *net/TCPConn does. Therefore the netpoll code would fail to get the file descriptor. Relevant issue here: https://github.com/mailru/easygo/issues/3 It is indeed possible to use reflect black magic to get the unexported member, but I have found unexpected errors during writing to the websocket by getting the file descriptor this way. I do not want to spend time investigating this especially since this is already released. Once this is out, we can decide on the right way to fix this, most probably by proposing to expose the File method or some other way. https://mattermost.atlassian.net/browse/MM-34000 ```release-note Fix an issue where websockets wouldn't work with TLS connections. In that case, we just fall back to the way it works for Windows machines, which is to use a separate goroutine for reader connection. ``` * Ignore logging errors on non-epoll On non-epoll systems, we needed to return an error to break from the loop. But in that case, there is no need to log the error
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
476846c28e
Коммит
2743089b54
@@ -5,7 +5,6 @@ package api4
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/gobwas/ws"
|
||||
@@ -49,7 +48,7 @@ func connectWebSocket(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.App.HubRegister(wc)
|
||||
}
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
if !wc.Epoll() {
|
||||
wc.BlockingPump()
|
||||
} else {
|
||||
go wc.Pump()
|
||||
|
||||
Ссылка в новой задаче
Block a user