Commit Graph

23 Commits

Author SHA1 Message Date
diamondburned 16a408bf30 wsutil: Refactored and decoupled structures for better thread safety 2020-10-28 10:19:22 -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 91ee92e9d5 Gateway: Fixed a race condition on ReconnectOP 2020-10-21 22:42:16 -07:00
diamondburned 6b4e26e839 wsutil: Improved internal code 2020-08-20 14:15:52 -07:00
diamondburned de61fd912d wsutil: Made PacemakerLoop valid as zero-value 2020-08-19 21:30:57 -07:00
Maximilian von Lindern 1585797b52 *: Linting and typo fixes (#134)
* Linting and typo fixes

* Linting and typo fixes

* revert comma fix
2020-07-29 16:58:33 -07:00
Maximilian von Lindern 32789bb6e2 *: Separate utils and internal (#129)
* Utils: move package utils/heart to internal/heart

* Utils: move package utils/moreatomic to internal/moreatomic

* Utils: move package utils/zlib to internal/zlib
2020-07-29 16:58:33 -07:00
diamondburned 5b37b2ab0d Gateway: Allow for longer timeouts 2020-07-14 18:47:52 -07:00
diamondburned c1885067d7 Gateway: Allow for more lenient gateway bursts 2020-07-14 18:47:15 -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) d82aa60fdc Utils: Added extra wsutil logging 2020-05-11 16:57:40 -07:00
diamondburned (Forefront) 73ba62605b Gateway: Fixed EOF not reconnecting bug 2020-05-06 16:06:06 -07:00
diamondburned (Forefront) 51e88a47b2 Gateway/Voice: Improved the event loop, fixed race conditions 2020-04-25 00:13:07 -07:00
diamondburned (Forefront) 3005c7b44a Voice: Separated UDP and WS into packages, added io.Writer API 2020-04-24 19:36:33 -07:00
diamondburned (Forefront) 54ac0a6951 Gateway: Migrated to wsutil.PacemakerLoop 2020-04-24 15:30:15 -07:00
diamondburned (Forefront) 443ec791af Heart: Moved PacemakerLoop to wsutil, changed Gateway abstractions to generic ones 2020-04-24 15:09:05 -07: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) 3d47bada07 Gateway: Fixed the double Close and Gateway ReconnectOP bugs 2020-04-11 12:34:40 -07:00
diamondburned (Forefront) 06136b7d5f Websocket: Replaced Conn's mutices with channels 2020-04-10 20:03:52 -07:00
diamondburned (Forefront) 86d32bdbe9 Utils: Removed redundant stdlib errors import 2020-04-09 16:19:52 -07:00
diamondburned (Forefront) cc530ce7a2 Bot: Allow func(T), added more documentation, minor fixes 2020-04-09 13:49:12 -07:00
diamondburned (Forefront) be12849668 Changed internal/ to utils/, allowing external imports 2020-04-08 19:28:40 -07:00