Commit Graph

59 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
diamondburned 94cca0adca httputil: Fixed unlock of unlocked mutex bug 2020-08-04 14:09:43 -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
mavolin ba4b224168 handler: move package from /handler to /utils/handler 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 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
Maximilian von Lindern de3d0e2160
Gateway: Split GuildCreateEvent (#116)
* Session: fix event handler loop not getting properly closed

* Implement #113

* Session: move guild events to state

* Session: close hStop
2020-06-06 13:47:15 -07:00
mavolin a76c9031c1 API: fix #91 2020-05-22 10:52:30 -07:00
mavolin 41ce1f389e
make all error messages lowercase 2020-05-16 23:14:49 +02:00
diamondburned (Forefront) ae793848aa Utils: Exposed NullableTData structs 2020-05-12 17:09:43 -07:00
Maximilian von Lindern ae14c8fb73
Merge branch 'master' into 44-data-structs 2020-05-12 03:57:35 +02:00
mavolin 04a80d33e8
API: add docs, use option types 2020-05-12 03:44:13 +02:00
diamondburned (Forefront) d82aa60fdc Utils: Added extra wsutil logging 2020-05-11 16:57:40 -07:00
mavolin dafda812dd
Utils: allow inheritance for custom types 2020-05-11 23:32:48 +02:00
mavolin bc188140f0
Utils: add NullableX types in option 2020-05-11 23:32:22 +02:00
mavolin b3bfc29732
Utils: move Enum to package enum 2020-05-11 22:43:52 +02:00
mavolin 4a30938db0
Utils: use package names for package doc file 2020-05-11 13:54:45 +02:00
mavolin b17c32187e
API: implement option and nullable types. 2020-05-11 05:24:59 +02:00
mavolin b30a1fb7d2
Utils: add custom option types 2020-05-11 05:24:12 +02:00
mavolin a29a521c5a
Utils: add nullable package 2020-05-11 04:30:34 +02:00
mavolin e522aaef9b
Discord: add Enum type 2020-05-11 03:24:11 +02:00
mavolin 795182df16
Discord: docs: add 2020-05-11 03:14:46 +02:00
mavolin c642c8f306
Discord: refactor: move json.OptionT to dedicated json/option package 2020-05-11 03:14:30 +02:00
diamondburned (Forefront) a298160529 API: Fixed schema error 2020-05-09 16:25:24 -07:00
diamondburned (Forefront) 0f38294048 API: Added GuildWithCount 2020-05-09 14:59:39 -07:00
diamondburned (Forefront) 3a43e413d8 Utils: Deprecated client-scoped JSON driver 2020-05-07 20:43:46 -07:00
diamondburned (Forefront) 52ca6638f5 Discord: Fixed incorrect Audit Log structures 2020-05-07 20:01:44 -07:00
diamondburned (Forefront) 56d189be3d Discord/API: Added Audit Log 2020-05-07 17:09:45 -07:00
diamondburned (Forefront) 9e33386546 Merge branch 'master' of github.com:diamondburned/arikawa 2020-05-07 12:33:06 -07:00
diamondburned (Forefront) 619558ecab API: Several breaking updates to conform with current documentation 2020-05-07 12:32:56 -07:00
mavolin e7c1c891fb
Utils: Create Constant for HTTP status code 429 2020-05-07 18:49:07 +02:00
mavolin c7a392f836
Utils: Fix #25 2020-05-07 18:36:15 +02:00
diamondburned (Forefront) 73ba62605b Gateway: Fixed EOF not reconnecting bug 2020-05-06 16:06:06 -07:00
diamondburned (Forefront) f22d6eaa9f Utils/API: Replaced semaphore-mutex API 2020-05-06 00:40:31 -07:00
diamondburned (Forefront) e07784a03a Utils: Swapped go-csync with /x/sync/semaphore 2020-05-06 00:32:21 -07:00
diamondburned (Forefront) 450a112878 Utils: Removed go-deadlock dependency meant to be used for debugging 2020-05-06 00:20:25 -07:00
diamondburned (Forefront) cb525ca5c0 Utils: Fixed a nil dereference bug 2020-05-05 15:36:14 -07:00
diamondburned (Forefront) 0c24ac627b Utils: Fixed bug where retries aren't applied options again, causing rate limits 2020-05-05 15:32:28 -07:00
diamondburned (Forefront) a0bccd9c35 API: Added WithContext API, closes #15 2020-05-03 14:02:03 -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