DO NOT MERGE - ChannelManager research for issue 160#406
Open
warsang wants to merge 1 commit intofoxssake:mainfrom
Open
DO NOT MERGE - ChannelManager research for issue 160#406warsang wants to merge 1 commit intofoxssake:mainfrom
warsang wants to merge 1 commit intofoxssake:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is related to #160 and just shows an example/toy implementation for research purposes. Unfortunately, this example doesn't work (and I'm not sure why) so please do not merge it. I mostly wanted to take a shot at supporting channels but not being super familiar with Netfox code, I wasn't able to pull it off. I still wanted to share the work to at least give an idea of what work would be required to get channel support for Netfox.
By default, Godot uses 3 channels for each transfer mode. The below ChannelManager is a bit naive, it should probably keep 1 channel per node instead of assigning one per rpc function meaning we call NetworkTime._channel_manager.get_channel() only once per node and assign that channel to all RPCs in the node. I think that approach would probably work better with unreliable/unreliable_ordered transfer modes?
We implement a channelManager that is instantiated in NetworkTime. -> (Is that the right place to instantiate this? ) When the ChannelManager is enabled, we call rpc_config instead of @rpc decorators for rpc functions because the channel argument in the decorator needs to be a constexpr. The reason we do that is because you apparently can't call a method in @rpc . The get_channel method assigns a channel to the method from a pool of available channels. We could subscribe to network events to assign/free channels in the pool if we get new synchronizer nodes or some are removed (peer disconnects etc.) ;