Skip to content

refactor!: remove channels, instead use delivery QoS directly#1116

Closed
mattwalsh-unity wants to merge 1 commit intodevelopfrom
refactor/remove_channels
Closed

refactor!: remove channels, instead use delivery QoS directly#1116
mattwalsh-unity wants to merge 1 commit intodevelopfrom
refactor/remove_channels

Conversation

@mattwalsh-unity
Copy link
Copy Markdown
Contributor

We probably won't have time to get this in, but I got this far today while waiting to work on other things. It builds; I haven't checked all the transports.


var writer = new DataStreamWriter(data.Count + 1 + 4, Allocator.Temp);
writer.WriteByte((byte)networkChannel);
writer.WriteByte((byte)networkDelivery);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming actually all these writes can be deleted, because this is probably so that the receiver can route the packet to the right channel, and if we don't care about channels this can be deleted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah, that'd be great!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is cirrect we can get rid of them.

@0xFA11 0xFA11 changed the title refactor!: remove channels refactor!: remove channels, instead use delivery QoS directly Aug 31, 2021
Comment on lines +57 to +61
//hrm for (int i = 0; i < Channels.Count; i++)
//hrm {
//hrm // Set the channels to a incrementing value
//hrm Channels[i].Id = (byte)((byte)NetworkDelivery.ChannelUnused + i);
//hrm }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kill OnValidate() entirely here?

m_ChannelIdToName.Add(channelId, (NetworkChannel)Channels[i].Id);
m_ChannelNameToId.Add((NetworkChannel)Channels[i].Id, channelId);
}
// Built-in netcode channels
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably convert "built-in" channels to use delivery types directly and get rid of this block here in this PR.

Comment on lines +22 to +23
NetworkEvent serverEvent = server.PollEvent(out ulong clientId, out NetworkDelivery _, out _, out _);
NetworkEvent clientEvent = client.PollEvent(out ulong serverId, out NetworkDelivery _, out _, out _);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
NetworkEvent serverEvent = server.PollEvent(out ulong clientId, out NetworkDelivery _, out _, out _);
NetworkEvent clientEvent = client.PollEvent(out ulong serverId, out NetworkDelivery _, out _, out _);
var serverEvent = server.PollEvent(out ulong clientId, out NetworkDelivery _, out _, out _);
var clientEvent = client.PollEvent(out ulong serverId, out NetworkDelivery _, out _, out _);

{
clientId = 0;
networkChannel = NetworkChannel.ChannelUnused;
networkDelivery = NetworkDelivery.ReliableSequenced; //??
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need to pop this now? because we did this before so the NetworkManager would know the channel but thats not required anymore?

Marshal.Copy((IntPtr)message.Data, arr, 0, size);
var payload = new ArraySegment<byte>(arr);
InvokeOnTransportEvent((NetcodeEvent)message.Type, clientId, (NetworkChannel)message.ChannelId, payload, Time.realtimeSinceStartup);
InvokeOnTransportEvent((NetcodeEvent)message.Type, clientId, (NetworkDelivery)message.ChannelId, payload, Time.realtimeSinceStartup);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above does the above caller need to know the QoS?

if (MessageQueueContainer.IsUsingBatching())
{
m_MessageBatcher.ReceiveItems(messageStream, ReceiveCallback, clientId, receiveTime, networkChannel);
m_MessageBatcher.ReceiveItems(messageStream, ReceiveCallback, clientId, receiveTime, networkDelivery);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the batching needs to know about the QoS?

@0xFA11
Copy link
Copy Markdown
Contributor

0xFA11 commented Sep 2, 2021

superseded by PR #1133

@0xFA11 0xFA11 closed this Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants