1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-10-31 20:14:21 +00:00
Commit graph

19 commits

Author SHA1 Message Date
Maximilian von Lindern 528281b739
gateway: Fix Context overwrite in Gateway.Open (#285)
* Gateway: Fix Gateway.Open overwriting the context argument

* WSUtil: Remove max context timeout in Websocket.Dial

* WSUtil: Use Websocket.Timeout if a no-deadline context is given to .Dial

* WSUtil: Add doc to Websocket.Timeout clarifying that it must not be changed after use
2021-10-20 15:06:06 -07:00
EvieDelta 29a3094a75
gateway: Possible Close/Send deadlock bug (#244)
when websocket send error happens in wsutil.(Websocket).SendCtx

Co-authored-by: EvieDelta <no public email>
2021-07-11 10:56:18 -07:00
diamondburned 5b328bdab0 shard: Remake shard manager (#226) 2021-06-14 15:22:55 -07:00
Maximilian von Lindern a3a3f5a1b8 wsutil: Make wsutil.GracefulCloser part of wsutil.Connection 2021-05-29 22:17:49 -07:00
Maximilian von Lindern ebc74e3168
Gateway: Sharding callback, proper closing (#190)
* Gateway: Fix gateway reconnect

This commit uses the correct timeout, Gateway.ReconnectTimeout, when reconnecting. Furthermore, it adds a delay between consecutive, failed reconnects.

* Gateway: Stop pacemaker when calling Gateway.CloseGracefully

* API: remove unnecessary leading/trailing whitespaces

* Gateway: Add Gateway.OnScalingRequired callback

* Gateway: Make all user initiated user closures graceful and ensure that closures are respected during reconnects

* Gateway: Fix typo

* Gateway: Add Gateway.ReconnectAttempts and deprecate .ReconnectTimeout

* Gateway: Add Gateway.Pause and reexport .Reconnect and .ReconnectCtx

* Gateway: Improve the Gateway.OnShardingRequired docs

* Wsutil: Code cleanup
2021-04-07 11:38:26 -07:00
Maximilian von Lindern a969b11709
Gateway: Add graceful closing with CloseGracefully (#185)
* gateway: add the possibility of graceful closure

* wsutil: rename ConnGracefulCloser to GracefulCloser

* Gateway: rename Gateway.CloseSession to .CloseGracefully
2021-01-29 20:25:10 -08:00
diamondburned a3aa490024 wsutil: Reset SendLimiter after Dial 2020-11-01 10:12:35 -08:00
diamondburned bd1696ef65 wsutil: Added super verbose logs 2020-11-01 10:12:31 -08:00
diamondburned a46d3c2c8d wsutil: Added possibly missing Reset cases and more debug logs 2020-10-31 15:54:51 -07:00
diamondburned 16c1658163 {,Voice}Gateway: Refactored Closing
This commit refactors both wsutil, the normal Gateway and the Voice
Gateway to have better closing behavior, which should assume less and
cover edge cases completely.
2020-10-30 11:02:37 -07:00
diamondburned 7668fe940c wsutil: Websocket wrapper thread safety for simpler Conn impl
This commit removes the thread safety requirement that Conn
implementations must satisfy. It moves the mutex guards as well as the
multiple close wrapper over to the Websocket wrapper instead.
2020-10-29 11:24:45 -07:00
diamondburned 6c332ac145 {Voice,}Gateway: Fixed various race conditions
This commit fixes race conditions in both package voice, package
voicegateway and package gateway.

Originally, several race conditions exist when both the user's and the
pacemaker's goroutines both want to do several things to the websocket
connection. For example, the user's goroutine could be writing, and the
pacemaker's goroutine could trigger a reconnection. This is racey.

This issue is partially fixed by removing the pacer loop from package
heart and combining the ticker into the event (pacemaker) loop itself.

Technically, a race condition could still be triggered with care, but
the API itself never guaranteed any of those. As events are handled
using an internal loop into a channel, a race condition will not be
triggered just by handling events and writing to the websocket.
2020-10-22 10:47:27 -07:00
diamondburned 6b4e26e839 wsutil: Improved internal code 2020-08-20 14:15:52 -07:00
diamondburned 5b37b2ab0d Gateway: Allow for longer timeouts 2020-07-14 18:47:52 -07:00
diamondburned f33b4ff7d8 wsutil: API changed to support contexts 2020-07-11 12:49:28 -07:00
mavolin 41ce1f389e
make all error messages lowercase 2020-05-16 23:14:49 +02:00
diamondburned (Forefront) 2f076c041e Gateway: Migrated functions and variables to other packages, added JSON default codecs 2020-04-23 23:34:08 -07:00
diamondburned (Forefront) 06136b7d5f Websocket: Replaced Conn's mutices with channels 2020-04-10 20:03:52 -07:00
diamondburned (Forefront) be12849668 Changed internal/ to utils/, allowing external imports 2020-04-08 19:28:40 -07:00
Renamed from internal/wsutil/ws.go (Browse further)