refactor!: remove channels, instead use delivery QoS directly#1116
refactor!: remove channels, instead use delivery QoS directly#1116mattwalsh-unity wants to merge 1 commit intodevelopfrom
Conversation
|
|
||
| var writer = new DataStreamWriter(data.Count + 1 + 4, Allocator.Temp); | ||
| writer.WriteByte((byte)networkChannel); | ||
| writer.WriteByte((byte)networkDelivery); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
That is cirrect we can get rid of them.
| //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 } |
There was a problem hiding this comment.
kill OnValidate() entirely here?
| m_ChannelIdToName.Add(channelId, (NetworkChannel)Channels[i].Id); | ||
| m_ChannelNameToId.Add((NetworkChannel)Channels[i].Id, channelId); | ||
| } | ||
| // Built-in netcode channels |
There was a problem hiding this comment.
we should probably convert "built-in" channels to use delivery types directly and get rid of this block here in this PR.
| NetworkEvent serverEvent = server.PollEvent(out ulong clientId, out NetworkDelivery _, out _, out _); | ||
| NetworkEvent clientEvent = client.PollEvent(out ulong serverId, out NetworkDelivery _, out _, out _); |
There was a problem hiding this comment.
nit:
| 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; //?? |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
I assume the batching needs to know about the QoS?
|
superseded by PR #1133 |
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.