-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite voice connection internals #9525
Commits on Sep 22, 2023
-
Configuration menu - View commit details
-
Copy full SHA for f8d2d00 - Browse repository at this point
Copy the full SHA f8d2d00View commit details -
Configuration menu - View commit details
-
Copy full SHA for ec3de31 - Browse repository at this point
Copy the full SHA ec3de31View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6febaf0 - Browse repository at this point
Copy the full SHA 6febaf0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 321c8b7 - Browse repository at this point
Copy the full SHA 321c8b7View commit details -
Configuration menu - View commit details
-
Copy full SHA for f2f7cf4 - Browse repository at this point
Copy the full SHA f2f7cf4View commit details -
Read packets from the socket until we get the ip discovery packet
If this isn't the initial connection, the socket fills up with rtp/rtcp packets, meaning you can't just read one when you reconnect. This has terrible implications for voice recv.
Configuration menu - View commit details
-
Copy full SHA for fc3f9da - Browse repository at this point
Copy the full SHA fc3f9daView commit details -
Resend speaking state upon reconnect
I finally found this bug. Reconnecting sends a none speaking state, so we need to send speaking again to be heard.
Configuration menu - View commit details
-
Copy full SHA for 7ddcd13 - Browse repository at this point
Copy the full SHA 7ddcd13View commit details -
Configuration menu - View commit details
-
Copy full SHA for fa3ddc1 - Browse repository at this point
Copy the full SHA fa3ddc1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 099f552 - Browse repository at this point
Copy the full SHA 099f552View commit details -
Rename connection_state to _voice_state
also add ws property
Configuration menu - View commit details
-
Copy full SHA for 536b11a - Browse repository at this point
Copy the full SHA 536b11aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5b8c372 - Browse repository at this point
Copy the full SHA 5b8c372View commit details -
Configuration menu - View commit details
-
Copy full SHA for 069f5bf - Browse repository at this point
Copy the full SHA 069f5bfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0f851ef - Browse repository at this point
Copy the full SHA 0f851efView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7931adc - Browse repository at this point
Copy the full SHA 7931adcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8a03951 - Browse repository at this point
Copy the full SHA 8a03951View commit details -
Configuration menu - View commit details
-
Copy full SHA for 220a786 - Browse repository at this point
Copy the full SHA 220a786View commit details -
Renamed VoiceClient._voice_state -> ._connection Renamed ConnectionStage -> ConnectionFlowState (tentatively) Renamed VoiceConnectionState._stage -> ._state Renamed VoiceConnectionState.stage -> .state Renamed parameters called stage -> state Renamed VoiceConnectionState._wait_for_stage -> ._wait_for_state Fix VoiceClient.wait_until_connected docstring
Configuration menu - View commit details
-
Copy full SHA for eb2c17a - Browse repository at this point
Copy the full SHA eb2c17aView commit details -
Rework ConnectionFlowState from bitfields to normal int enum and fix relevant comparisons. Remove obsolete exact param from _wait_for_state Remove IntEnum typing hack
Configuration menu - View commit details
-
Copy full SHA for 86b21d2 - Browse repository at this point
Copy the full SHA 86b21d2View commit details -
Since we can only check absolute states now we need to be able to check for multiple in _wait_for_state
Configuration menu - View commit details
-
Copy full SHA for 26fb0c1 - Browse repository at this point
Copy the full SHA 26fb0c1View commit details -
Configuration menu - View commit details
-
Copy full SHA for cc149b6 - Browse repository at this point
Copy the full SHA cc149b6View commit details -
Try to avoid doing ip discovery if unnecessary
One step towards trying to avoid a very annoying problem with reading packets from the socket as a shared resource (voice recv)
Configuration menu - View commit details
-
Copy full SHA for 071d873 - Browse repository at this point
Copy the full SHA 071d873View commit details -
Configuration menu - View commit details
-
Copy full SHA for 107921d - Browse repository at this point
Copy the full SHA 107921dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 726d243 - Browse repository at this point
Copy the full SHA 726d243View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6a6efab - Browse repository at this point
Copy the full SHA 6a6efabView commit details -
Configuration menu - View commit details
-
Copy full SHA for 12d4bb2 - Browse repository at this point
Copy the full SHA 12d4bb2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0ee4954 - Browse repository at this point
Copy the full SHA 0ee4954View commit details -
Refactor socket connection code and work on state stability
1. We're changing the socket from implicit connect using sendto to explicit connect with sock_connect, and making it use async functions while we're at it. 2. We're adding a timeout to the websocket connection+handshake part, and also splitting _connect_websocket into two functions, that and _handshake_websocket. Now the ws attribute gets assigned immediately after creation and not only after the handshake.
Configuration menu - View commit details
-
Copy full SHA for 6576d49 - Browse repository at this point
Copy the full SHA 6576d49View commit details -
Fix voice_state_update disconnect state confusion
Since there's no way to tell who or what a voice_state_update with channel=None came from, we have to remember if we were the ones who disconnected ourselves from the voice channel. Hopefully this is sane enough to withstand the average discord eventual consistency.
Configuration menu - View commit details
-
Copy full SHA for ed6379e - Browse repository at this point
Copy the full SHA ed6379eView commit details -
We switch to force=True by default, and now have a cleanup param to selectively run voice client cleanup.
Configuration menu - View commit details
-
Copy full SHA for 0f7cea7 - Browse repository at this point
Copy the full SHA 0f7cea7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5b02238 - Browse repository at this point
Copy the full SHA 5b02238View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0a0e646 - Browse repository at this point
Copy the full SHA 0a0e646View commit details -
Implement safe shared socket reading
The voice socket is no longer directly read from by the voice websocket to get the ip discovery packet. Now there is a socket reader thread object that handles this by using registered callbacks. This way there is no longer any for the socket to be improperly shared between any potential readers. In the base library this isn't important since the only thing the socket is read for is the ip discovery packet, but for *extensions implementing voice recv* its necessary. The thread pauses when there are no listeners attached as not to waste cpu time.
Configuration menu - View commit details
-
Copy full SHA for 3d71f62 - Browse repository at this point
Copy the full SHA 3d71f62View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2471f6a - Browse repository at this point
Copy the full SHA 2471f6aView commit details -
Clean up ip discovery future handling Rename _self_paused to _idle_paused Misc
Configuration menu - View commit details
-
Copy full SHA for dee6e3d - Browse repository at this point
Copy the full SHA dee6e3dView commit details -
Partially fix connection durability issues
Fixing checks and timeouts mostly. The change to move_to is mostly a band-aid fix. It doesn't solve the underlying problem but it removes that vector for causing it.
Configuration menu - View commit details
-
Copy full SHA for 0b5e1a1 - Browse repository at this point
Copy the full SHA 0b5e1a1View commit details -
Maybe fully fix voice reconnection instability
By moving connect() to a task we can cancel it and restart, making it easier to handle overlapping reconnects. It seems to work from my testing but i'm not entirely sure its sound, specifically the whole 'stopping the ws runner task' part. If anything its racy but that remains to be seen.
Configuration menu - View commit details
-
Copy full SHA for 59f121e - Browse repository at this point
Copy the full SHA 59f121eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 53992b6 - Browse repository at this point
Copy the full SHA 53992b6View commit details -
Go over comments, logging, and minor changes
There are a bunch of TODOs that need input or a decision on
Configuration menu - View commit details
-
Copy full SHA for 6196016 - Browse repository at this point
Copy the full SHA 6196016View commit details -
Remove ip caching, didn't really serve a purpose Add timeout param to move_to() Change BlockingIOError to OSError in send_audio_packet() Change task types to Optional instead of MISSING Properly transfer connect params and voice state to connect() calls Remove some uncertain code path handling TODOs Fix reconnecting in the ws runner task
Configuration menu - View commit details
-
Copy full SHA for d0bc55f - Browse repository at this point
Copy the full SHA d0bc55fView commit details -
Configuration menu - View commit details
-
Copy full SHA for f9200d0 - Browse repository at this point
Copy the full SHA f9200d0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 87bbf1a - Browse repository at this point
Copy the full SHA 87bbf1aView commit details -
Raise errors on connection problems Add default timeout to wait_until_connected Undocument wait_until_connected (its sync and only used internally once) Change some timeouts to 30s Floatify floats
Configuration menu - View commit details
-
Copy full SHA for e5bdd39 - Browse repository at this point
Copy the full SHA e5bdd39View commit details -
Configuration menu - View commit details
-
Copy full SHA for 92e2bbb - Browse repository at this point
Copy the full SHA 92e2bbbView commit details -
Configuration menu - View commit details
-
Copy full SHA for aaf15df - Browse repository at this point
Copy the full SHA aaf15dfView commit details -
Configuration menu - View commit details
-
Copy full SHA for db3a045 - Browse repository at this point
Copy the full SHA db3a045View commit details -
Configuration menu - View commit details
-
Copy full SHA for afdbb7d - Browse repository at this point
Copy the full SHA afdbb7dView commit details -
Add a factory for VoiceConnectionState
Good thing I remembered to do this or fixing this in my voice recv code would have been a little annoying.
Configuration menu - View commit details
-
Copy full SHA for 014147a - Browse repository at this point
Copy the full SHA 014147aView commit details
Commits on Sep 28, 2023
-
Configuration menu - View commit details
-
Copy full SHA for be55956 - Browse repository at this point
Copy the full SHA be55956View commit details -
Configuration menu - View commit details
-
Copy full SHA for ce4cb2f - Browse repository at this point
Copy the full SHA ce4cb2fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 719fdf1 - Browse repository at this point
Copy the full SHA 719fdf1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 515da08 - Browse repository at this point
Copy the full SHA 515da08View commit details