Commit Graph

27 Commits

Author SHA1 Message Date
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 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
diamondburned 6717f8002c Gateway: Fixed autoreconnect misusing context 2020-07-15 16:39:40 -07:00
diamondburned edb8a46ef2 Gateway: Added intent helpers and more context API support 2020-07-11 12:50:32 -07:00
mavolin 41ce1f389e
make all error messages lowercase 2020-05-16 23:14:49 +02:00
diamondburned ccf4c69801
Merge pull request #14 from matthewpi/feature/voice 2020-04-24 19:58:26 -07:00
diamondburned (Forefront) 95624292f7 Gateway: Deprecated OP chan API, use PacerLoop.Extras instead 2020-04-24 15:32:14 -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) a2a1ccd01e Gateway: Fixed Invalid Session retrying forever bug 2020-04-22 14:45:19 -07:00
diamondburned (Forefront) 813be25713 Gateway: Fixed infinite InvalidSession loop 2020-04-13 18:23:38 -07:00
diamondburned (Forefront) 4e4ebde93a Gateway: Deprecated Wait(), fixed ReconnectOP bug 2020-04-12 11:06:43 -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
diamondburned (Forefront) 33061e916f Gateway: Now waits for either READY or RESUMED before finishing Open() 2020-04-06 13:27:33 -07:00
diamondburned (Forefront) 9f5c2ac958 Gateway: Switched to gorilla/websocket, fixes #11 2020-04-06 13:27:29 -07:00
diamondburned (Forefront) 8899462ff0 Gateway: Added undocumented GuildMemberListUpdate event 2020-03-15 22:55:45 -07:00
diamondburned (Forefront) 4e9bd53b0f Gateway: Added extra events 2020-02-15 21:29:25 -08:00
diamondburned (Forefront) 0de1e579f3 State: Author* methods now try and use Message.Member 2020-02-12 20:19:24 -08:00
diamondburned (Forefront) 85b793a1a7 Fixed some race conditions 2020-02-02 14:12:54 -08:00
diamondburned (Forefront) 971c162d33 Fixed bug where reconnect would fail 2020-01-17 23:40:44 -08:00
diamondburned d1341b61b3
Gateway integration test + Bug fixes 2020-01-15 19:28:21 -08:00
diamondburned 127c636310 Moved misc packages to internal 2020-01-15 10:32:54 -08:00
diamondburned (Forefront) 03d226e23d WIP integration test 2020-01-14 23:34:18 -08:00
diamondburned 8fc7229c3f
Added an untested Gateway package 2020-01-14 20:43:34 -08:00