Fix Peertube crash:

Peertube could crash when someone attemps to connect to Websocket endpoint during plugin initialization.
This commit is contained in:
John Livingston 2023-04-17 11:14:41 +02:00
parent aa1170a3f4
commit 310419ad66
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
2 changed files with 5 additions and 1 deletions

View File

@ -11,6 +11,7 @@
* Diagnostic tool: add the result of `prosodyctl check` in the debug section. * Diagnostic tool: add the result of `prosodyctl check` in the debug section.
* New debug mode * New debug mode
* Fix room topic: due to a [bug in mod_muc_http_defaults](https://hg.prosody.im/prosody-modules/rev/6d99ddd99694), room topics were badly configured. The plugin will fix them at startup, and stops trying to set the subject. * Fix room topic: due to a [bug in mod_muc_http_defaults](https://hg.prosody.im/prosody-modules/rev/6d99ddd99694), room topics were badly configured. The plugin will fix them at startup, and stops trying to set the subject.
* Fix Peertube crash when someone attemps to connect to Websocket endpoint during plugin initialization.
## 6.2.3 ## 6.2.3

View File

@ -234,7 +234,10 @@ async function initWebchatRouter (options: RegisterServerOptionsV5): Promise<Rou
route: '/xmpp-websocket', route: '/xmpp-websocket',
handler: (request, socket, head) => { handler: (request, socket, head) => {
if (!currentWebsocketProxy) { if (!currentWebsocketProxy) {
throw new Error('There is no current websocket proxy, should not get here.') peertubeHelpers.logger.error('There is no current websocket proxy, should not get here.')
// no need to close the socket, Peertube will
// (see https://github.com/Chocobozzz/PeerTube/issues/5752#issuecomment-1510870894)
return
} }
currentWebsocketProxy.ws(request, socket, head) currentWebsocketProxy.ws(request, socket, head)
} }