3
0
mirror of https://github.com/ergochat/ergo.git synced 2025-01-22 18:24:17 +01:00

Merge pull request #2117 from slingamn/handlepanic

add panic handler to async client/channel writes
This commit is contained in:
Shivaram Lingamneni 2024-01-05 00:21:23 -05:00 committed by GitHub
commit 0f059ea2cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -222,6 +222,8 @@ func (channel *Channel) wakeWriter() {
// equivalent of Socket.send() // equivalent of Socket.send()
func (channel *Channel) writeLoop() { func (channel *Channel) writeLoop() {
defer channel.server.HandlePanic()
for { for {
// TODO(#357) check the error value of this and implement timed backoff // TODO(#357) check the error value of this and implement timed backoff
channel.performWrite(0) channel.performWrite(0)

View File

@ -1773,6 +1773,8 @@ func (client *Client) wakeWriter() {
} }
func (client *Client) writeLoop() { func (client *Client) writeLoop() {
defer client.server.HandlePanic()
for { for {
client.performWrite(0) client.performWrite(0)
client.writebackLock.Unlock() client.writebackLock.Unlock()