Commit Graph

25 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 3312c66515 Voice: Made EventLoop a valid struct value instead of nil pointer 2020-08-19 21:32:40 -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 908ef96089 Discord: Uint64 typed Snowflakes (#132)
* Use typed Snowflakes if possible

* Discord: make Snowflakes uint64

* Fix errors that emerged because of new typing
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
Maximilian von Lindern 78c36f13cd Discord: Rename Snowflake and Timestamp Valid methods (#128)
* Discord: rename Snowflake.Valid() to IsValid()

* Discord: rename Timestamp.Valid() to IsValid()
2020-07-29 16:58:33 -07:00
Tadeo Kondrak d290b0d01c *: Add typed Snowflake IDs (#122)
This PR closes #120.
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
diamondburned (Forefront) 9da01cccb3 Voice: Fixed a potential Write() stalling bug 2020-05-20 15:05:50 -07:00
mavolin 41ce1f389e
make all error messages lowercase 2020-05-16 23:14:49 +02:00
Matthew Penner 3aa92c8f05 Only add the guild to SessionErrors if the error is not nil 2020-05-13 15:38:07 -06:00
Matthew Penner 60346f23bb Close voice connections when Close() is called 2020-05-13 14:43:00 -06:00
diamondburned (Forefront) 23b0abdfec Adopted several packages to use NullSnowflake and NullSeconds 2020-05-08 14:25:07 -07:00
diamondburned (Forefront) 51e88a47b2 Gateway/Voice: Improved the event loop, fixed race conditions 2020-04-25 00:13:07 -07:00
diamondburned (Forefront) cc153e1715 Voice: Updated package description 2020-04-24 20:29:14 -07:00
diamondburned (Forefront) f2d93fe2ba Voice: Updated README 2020-04-24 20:14:06 -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) c0c17085ba Heart: Migrated Voice to PacemakerLoop 2020-04-23 20:52:18 -07:00
diamondburned (Forefront) 4cfde32531 Voice: Added an integration test 2020-04-23 20:52:12 -07:00
Matthew Penner 6a029e0c80 Improvements to the way voice waits for events 2020-04-21 16:37:22 -06:00
Matthew Penner 7b17afc8e9 Improvements to voice/README.md 2020-04-21 16:37:22 -06:00
Matthew Penner 1e5e0ac38a Update go.sum, add voice/README.md with basic information on how the voice package functions 2020-04-21 16:37:22 -06:00
Matthew Penner f429010ded Add janky voice support 2020-04-21 16:37:22 -06:00