aboutsummaryrefslogtreecommitdiff
path: root/discord/gateway.py
Commit message (Collapse)AuthorAgeFilesLines
* Add internal method to check if the websocket is currently ratelimitedRapptz2020-10-171-0/+9
|
* Fix disconnect when trying to move to another voice channel.Rapptz2020-10-171-1/+2
| | | | | | | | | | Not overly proud of this implementation but this allows the library to differentiate between a 4014 that means "move to another channel" or "move nowhere". Sometimes the VOICE_STATE_UPDATE comes before the actual websocket disconnect so special care had to be taken in that case. Fix #5904
* Check for zombie connections through last received payloadRapptz2020-09-231-1/+9
| | | | | | | The previous code would check zombie connections depending on whether HEARTBEAT_ACK was received. Unfortunately when there's exceeding backpressure the connection can terminate since the HEARTBEAT_ACK is buffered very far away despite it being there, just not received yet.
* Use a lock for the gateway rate limiter.Rapptz2020-09-231-5/+12
| | | | | This will allow for higher concurrency in AutoSharded situations where I can mostly "fire and forget" the chunk requests.
* Heartbeats bypass the rate limits for gatewayRapptz2020-09-231-3/+14
|
* Rewrite chunking to work with intents.Rapptz2020-09-231-1/+1
| | | | | | | | This slows down chunking significantly for bots in a large number of guilds since it goes down from 75 guilds/request to 1 guild/request. However the logic was rewritten to fire the chunking request immediately after receiving the GUILD_CREATE rather than waiting for all the guilds in the ready stream before doing it.
* Add more close codes that can't be handled for reconnecting.Rapptz2020-09-231-1/+1
|
* Handle gateway rate limits by using a rate limiter.Rapptz2020-09-231-0/+31
| | | | | With the new chunking changes this will become necessary and we don't want to disconnect from having too many outwards requests.
* Add support for guild intentsRapptz2020-09-231-0/+3
|
* Correct some protocol errors in v4 of voice gatewayRapptz2020-09-231-9/+8
|
* Guard uses of the keep alive thread in case they're NoneRapptz2020-09-091-3/+5
| | | | Fixes #5800
* Terminate connection if a close code couldn't be handledRapptz2020-08-061-1/+1
|
* Propagate manual close codes to socket subclassRapptz2020-08-051-5/+11
| | | | aiohttp seems to not set it during its state machine flow
* Use a subclass rather than monkey-patching for the websocketjack11422020-07-251-8/+3
|
* Add a timeout for receiving websocket messages.Rapptz2020-07-251-4/+8
|
* Handle Connection Reset by Peer connection errors.Rapptz2020-07-251-4/+10
| | | | | | | | | | | | This should work both on Windows and on Linux. Apparently these types of blips are considered normal for Discord. So rather than letting the reconnect logic handler expect these to be catastrophic, it should handle it specially so it doesn't waste an IDENTIFY for what ultimately should just be a small networking blip. This also makes it less noisy for the end-user as these complaints happen from time to time.
* Add shard related connection and resume events.Rapptz2020-07-251-0/+4
| | | | | | | These include: * on_shard_resumed * on_shard_connect * on_shard_disconnect
* Add before_identify_hook to have finer control over IDENTIFY syncingRapptz2020-07-251-1/+4
|
* Fix voice websocket connectionsRapptz2020-07-251-4/+5
|
* Rewrite gateway to use aiohttp instead of websocketsRapptz2020-07-251-57/+75
|
* Can't use %d in hereRapptz2020-07-251-3/+3
|
* Add shard ID to keep alive logger messagesRapptz2020-07-251-9/+9
|
* Rewrite of AutoShardedClient to prevent overlapping identifyRapptz2020-07-251-11/+11
| | | | This is experimental and I'm unsure if it actually works
* Add user_ids fields for query_membersTarek2020-05-291-2/+8
|
* Fix timeout issues with fetching members via query_membersRapptz2020-05-101-2/+6
| | | | | | | | | | | | This uses the nonce field to properly disambiguate queries. There's also some redesigning going on behind the scenes and minor clean-up. Originally I planned on working on this more to account for the more widespread chunking changes planned for gateway v7 but I realized that this would indiscriminately slow down everyone else who isn't planning on working with intents for now. I will work on the larger chunking changes in the future, should time allow for it.
* Bump blocking threshold from 5 seconds to 10 secondsRapptz2020-04-141-3/+3
|
* Add traceback to debug blocking issuesRapptz2020-04-141-1/+12
|
* Move log levels around to make INFO a little less noisyRapptz2020-04-061-3/+3
|
* Fix VoiceClient.average_latency erroring when heartbeat is NoneRapptz2020-04-061-2/+4
|
* Added VoiceClient.latency and VoiceClient.average_latencyFwf2020-04-041-3/+23
| | | | | This also implements the heartbeating a bit more consistent to the official Discord client.
* Change default close code to 4000 instead of 1000.Rapptz2020-04-041-1/+1
| | | | | | | | | | This prevents our sessions from being invalidated by Discord which caused a lot of failures when resuming. This caused an unnecessary amount of IDENTIFYs to happen depending on the circumstances. Closes #2631 See also discord/discord-api-docs#1472
* Downgrade unknown event logging to DEBUG rather than WARNINGRapptz2020-01-261-1/+1
| | | | It's too noisy
* Bump copyright year to 2020Rapptz2020-01-191-1/+1
| | | | Closes #2510
* Expose _ActivityTag as BaseActivity to easily refer to.Rapptz2020-01-141-3/+3
|
* Wait 5 seconds before IDENTIFYing with an invalidated session.Rapptz2019-12-171-0/+1
|
* The port is a big endian unsigned short.Lorenzo2019-12-061-3/+1
| | | See https://github.com/discordapp/discord-api-docs/pull/1244
* Fix more deprecation warnings for 3.8Rapptz2019-11-261-1/+1
|
* Fix more deprecation warningsRapptz2019-11-201-1/+1
|
* use proper ip for endpoint ipJake2019-07-171-0/+1
|
* Add Guild.query_members to fetch members from the gateway.Rapptz2019-07-151-0/+11
|
* Add support for guild subscriptions.Rapptz2019-07-101-0/+1
|
* Improve documentationNCPlayz2019-06-071-1/+1
|
* Use a dict instead of getattr for parsing events.Rapptz2019-05-291-4/+3
| | | | | | | | | | | Probably not a significant difference but might as well use it here. The basic idea is to cache the getattr calls instead of repeatedly doing it (since they're around 105ns on my machine). The dictionary lookup is about 41ns on my machine. The next step in speeding up library code some more should be in the parser bodies themselves but that's a problem to tackle another day.
* Consistent use of __all__ to prevent merge conflicts.Rapptz2019-04-201-2/+7
|
* Organise documentationNCPlayz2019-03-191-2/+2
|
* Warn on high latency and blocking heartbeatHornwitser2019-01-281-1/+16
| | | | | | | Add warnings for when the heartbeat is blocked for a long time and when the websocket latency is excessively high. These indicate problems with blocking the event loop and/or insufficient computing resources to keep up with the demand.
* Update voice code to vws V4Imayhaveborkedit2019-01-281-11/+38
| | | | | | | - Update internals to be compatible with v4 - Adds multiple encryption mode support. Previously only `xsalsa20_poly1305` was supported. Now `xsalsa20_poly1305_suffix` is also supported. Note: There is no (nice) way to manually select a mode. The user needn't worry about this however. - Fixed speaking state bug. When you disconnected from a voice channel while a bot was playing, upon reconnect you would be unable to hear the bot. This was caused by bots not sending their speaking state while transmitting. Bots will now set their speaking state properly when transmitting. Note: This does not account for sending actual silence, the speaking indicator will still be active.
* Fix accidental regression of 9bc48b2 in fa46b07Hornwitser2019-01-281-1/+1
| | | | | Occured due to difficult to spot difference in git merge when rebasing the lint changes.
* Bumped copyright years to 2019.Dante Dam2019-01-281-1/+1
|
* Add override to `close()` method to the websocket subclass.CraftSpider2018-12-141-0/+6
| | | | | This makes it so that _keep_alive is stopped no matter which closing method is called