Skip to content

Commit

Permalink
1.5.0
Browse files Browse the repository at this point in the history
- FishNetworking 1.3.1 Multipass transport support.
  • Loading branch information
FirstGearGames committed Feb 19, 2022
1 parent 81bfaaa commit 0071c3a
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 27 deletions.
3 changes: 3 additions & 0 deletions FishNet/Plugins/FishySteamworks/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1.5.0
- FishNetworking 1.3.1 Multipass transport support.

1.4.4
- Removed obsolete method.

Expand Down
2 changes: 1 addition & 1 deletion FishNet/Plugins/FishySteamworks/Core/ClientHostSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ internal void IterateIncoming()
while (_incoming.TryDequeue(out LocalPacket packet))
{
ArraySegment<byte> segment = new ArraySegment<byte>(packet.Data, 0, packet.Length);
base.Transport.HandleClientReceivedDataArgs(new ClientReceivedDataArgs(segment, (Channel)packet.Channel));
base.Transport.HandleClientReceivedDataArgs(new ClientReceivedDataArgs(segment, (Channel)packet.Channel, Transport.Index));
ByteArrayPool.Store(packet.Data);
}
}
Expand Down
2 changes: 1 addition & 1 deletion FishNet/Plugins/FishySteamworks/Core/ClientSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ internal void IterateIncoming()
for (int i = 0; i < messageCount; i++)
{
base.GetMessage(base.MessagePointers[i], InboundBuffer, out ArraySegment<byte> segment, out byte channel);
base.Transport.HandleClientReceivedDataArgs(new ClientReceivedDataArgs(segment, (Channel)channel));
base.Transport.HandleClientReceivedDataArgs(new ClientReceivedDataArgs(segment, (Channel)channel, Transport.Index));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions FishNet/Plugins/FishySteamworks/Core/CommonSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ protected virtual void SetLocalConnectionState(LocalConnectionStates connectionS
_connectionState = connectionState;

if (server)
Transport.HandleServerConnectionState(new ServerConnectionStateArgs(connectionState));
Transport.HandleServerConnectionState(new ServerConnectionStateArgs(connectionState, Transport.Index));
else
Transport.HandleClientConnectionState(new ClientConnectionStateArgs(connectionState));
Transport.HandleClientConnectionState(new ClientConnectionStateArgs(connectionState, Transport.Index));
}
#endregion

Expand Down
12 changes: 6 additions & 6 deletions FishNet/Plugins/FishySteamworks/Core/ServerSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private bool StopConnection(int connectionId, HSteamNetConnection socket)
_steamIds.Remove(connectionId);
if (base.Transport.NetworkManager.CanLog(LoggingType.Common))
Debug.Log($"Client with ConnectionID {connectionId} disconnected.");
base.Transport.HandleRemoteConnectionState(new RemoteConnectionStateArgs(RemoteConnectionStates.Stopped, connectionId));
base.Transport.HandleRemoteConnectionState(new RemoteConnectionStateArgs(RemoteConnectionStates.Stopped, connectionId, Transport.Index));
_cachedConnectionIds.Enqueue(connectionId);

return true;
Expand Down Expand Up @@ -272,7 +272,7 @@ private void OnRemoteConnectionState(SteamNetConnectionStatusChangedCallback_t a

if (base.Transport.NetworkManager.CanLog(LoggingType.Common))
Debug.Log($"Client with SteamID {clientSteamID} connected. Assigning connection id {connectionId}");
base.Transport.HandleRemoteConnectionState(new RemoteConnectionStateArgs(RemoteConnectionStates.Started, connectionId));
base.Transport.HandleRemoteConnectionState(new RemoteConnectionStateArgs(RemoteConnectionStates.Started, connectionId, Transport.Index));
}
else if (args.m_info.m_eState == ESteamNetworkingConnectionState.k_ESteamNetworkingConnectionState_ClosedByPeer || args.m_info.m_eState == ESteamNetworkingConnectionState.k_ESteamNetworkingConnectionState_ProblemDetectedLocally)
{
Expand Down Expand Up @@ -321,7 +321,7 @@ internal void IterateIncoming()
while (_clientHostIncoming.TryDequeue(out LocalPacket packet))
{
ArraySegment<byte> segment = new ArraySegment<byte>(packet.Data, 0, packet.Length);
base.Transport.HandleServerReceivedDataArgs(new ServerReceivedDataArgs(segment, (Channel)packet.Channel, FishySteamworks.CLIENT_HOST_ID));
base.Transport.HandleServerReceivedDataArgs(new ServerReceivedDataArgs(segment, (Channel)packet.Channel, FishySteamworks.CLIENT_HOST_ID, Transport.Index));
}

foreach (KeyValuePair<HSteamNetConnection, int> item in _steamConnections.First)
Expand All @@ -340,7 +340,7 @@ internal void IterateIncoming()
for (int i = 0; i < messageCount; i++)
{
base.GetMessage(base.MessagePointers[i], InboundBuffer, out ArraySegment<byte> segment, out byte channel);
base.Transport.HandleServerReceivedDataArgs(new ServerReceivedDataArgs(segment, (Channel)channel, connectionId));
base.Transport.HandleServerReceivedDataArgs(new ServerReceivedDataArgs(segment, (Channel)channel, connectionId, Transport.Index));
}
}
}
Expand Down Expand Up @@ -445,11 +445,11 @@ internal void OnClientHostState(bool started)
if (!started)
{
while (_clientHostIncoming.TryDequeue(out _)) ;
base.Transport.HandleRemoteConnectionState(new RemoteConnectionStateArgs(RemoteConnectionStates.Stopped, FishySteamworks.CLIENT_HOST_ID));
base.Transport.HandleRemoteConnectionState(new RemoteConnectionStateArgs(RemoteConnectionStates.Stopped, FishySteamworks.CLIENT_HOST_ID, Transport.Index));
}
else
{
base.Transport.HandleRemoteConnectionState(new RemoteConnectionStateArgs(RemoteConnectionStates.Started, FishySteamworks.CLIENT_HOST_ID));
base.Transport.HandleRemoteConnectionState(new RemoteConnectionStateArgs(RemoteConnectionStates.Started, FishySteamworks.CLIENT_HOST_ID, Transport.Index));
}


Expand Down
18 changes: 2 additions & 16 deletions FishNet/Plugins/FishySteamworks/FishySteamworks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ public class FishySteamworks : Transport
internal const int CLIENT_HOST_ID = short.MaxValue;
#endregion

public override void Initialize(NetworkManager networkManager)
public override void Initialize(NetworkManager networkManager, int transportIndex)
{
base.Initialize(networkManager);
base.Initialize(networkManager, transportIndex);

_client = new Client.ClientSocket();
_clientHost = new Client.ClientHostSocket();
Expand Down Expand Up @@ -558,20 +558,6 @@ private bool StopClient(int connectionId, bool immediately)

#region Channels.
/// <summary>
/// Returns which channel to use by default for reliable.
/// </summary>
public override byte GetDefaultReliableChannel()
{
return 0;
}
/// <summary>
/// Returns which channel to use by default for unreliable.
/// </summary>
public override byte GetDefaultUnreliableChannel()
{
return 1;
}
/// <summary>
/// Gets the MTU for a channel. This should take header size into consideration.
/// For example, if MTU is 1200 and a packet header for this channel is 10 in size, this method should return 1190.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion FishNet/Plugins/FishySteamworks/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.4
1.5.0

0 comments on commit 0071c3a

Please sign in to comment.