Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
Merge branch 'main' of https://github.com/MirrorNG/KCPTransport into …
Browse files Browse the repository at this point in the history
…main
  • Loading branch information
paulpach committed Oct 12, 2020
2 parents 0f6b6aa + 45f6d20 commit 98fd9e5
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 17 deletions.
6 changes: 6 additions & 0 deletions Assets/KCP/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 1.0.0 (2020-10-12)


### Performance Improvements

* no need to await main thread ([de5699f](https://github.com/MirrorNG/KCPTransport/commit/de5699fd7abc67334916fde930ead69e9b718e56))
3 changes: 0 additions & 3 deletions Assets/KCP/KcpClientConnection.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
using Cysharp.Threading.Tasks;
using UnityEngine;

namespace Mirror.KCP
{
Expand Down
6 changes: 3 additions & 3 deletions Assets/KCP/KcpConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public abstract class KcpConnection : IConnection
protected Socket socket;
protected EndPoint remoteEndpoint;
protected KCP kcp;
private volatile bool open;
volatile bool open;

// If we don't receive anything these many milliseconds
// then consider us disconnected
public const int TIMEOUT = 3000;

private volatile uint lastReceived = 0;
volatile uint lastReceived = 0;

internal static readonly ArraySegment<byte> Hello = new ArraySegment<byte>(new byte[] { 0 });
private static readonly ArraySegment<byte> Goodby = new ArraySegment<byte>(new byte[] { 1 });
Expand All @@ -38,7 +38,7 @@ protected void SetupKcp()
_ = Tick();
}

private async UniTask Tick()
async UniTask Tick()
{
try
{
Expand Down
1 change: 0 additions & 1 deletion Assets/KCP/KcpServerConnection.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Net;
using System.Net.Sockets;
using UnityEngine;

namespace Mirror.KCP
{
Expand Down
7 changes: 0 additions & 7 deletions Assets/KCP/KcpTransport.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
Expand Down Expand Up @@ -66,12 +65,6 @@ void RawInput(EndPoint endpoint, byte[] data, int msgLength)
/// </summary>
public override void Disconnect()
{
// disconnect all connections and stop listening to the port
/*foreach (KcpServerConnection connection in connectedClients.Values)
{
connection.Disconnect();
}*/

socket?.Close();
socket = null;
}
Expand Down
4 changes: 2 additions & 2 deletions Assets/KCP/Segment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal class Segment
internal bool acked;
internal ByteBuffer data;

private static readonly Stack<Segment> msSegmentPool = new Stack<Segment>(32);
static readonly Stack<Segment> msSegmentPool = new Stack<Segment>(32);

public static Segment Get(int size)
{
Expand All @@ -39,7 +39,7 @@ public static void Put(Segment seg)
msSegmentPool.Push(seg);
}

private Segment(int size)
Segment(int size)
{
data = ByteBuffer.Allocate(size, true);
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/KCP/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.mirrorng.kcptransport",
"displayName": "MirrorNG KCPTransport",
"version": "1.1.0",
"version": "1.0.0",
"unity": "2019.1",
"description": "UDP transport for MirrorNG",
"author": "Paul Pacheco",
Expand Down

0 comments on commit 98fd9e5

Please sign in to comment.