Make some neatness updates
This commit is contained in:
parent
63eddfa43b
commit
7b426f4f8c
@ -12,10 +12,9 @@ namespace NeonTea.Quakeball.Net.Peers {
|
|||||||
private Peer Peer;
|
private Peer Peer;
|
||||||
|
|
||||||
private Thread UpdateThread;
|
private Thread UpdateThread;
|
||||||
private long LastUpdate;
|
|
||||||
|
|
||||||
public long Timeout = 8000;
|
public long Timeout = 8000;
|
||||||
public long Frequency = 100;
|
public long Interval = 100;
|
||||||
|
|
||||||
public ConnectionManager(Peer peer) {
|
public ConnectionManager(Peer peer) {
|
||||||
Peer = peer;
|
Peer = peer;
|
||||||
@ -159,10 +158,8 @@ namespace NeonTea.Quakeball.Net.Peers {
|
|||||||
|
|
||||||
private void UpdateThreadMethod() {
|
private void UpdateThreadMethod() {
|
||||||
try {
|
try {
|
||||||
while (true) {
|
while (Thread.CurrentThread.IsAlive) {
|
||||||
long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||||
if ((now - LastUpdate) > Frequency) {
|
|
||||||
LastUpdate = now;
|
|
||||||
List<KeyValuePair<IPEndPoint, Connection>> timedOut = new List<KeyValuePair<IPEndPoint, Connection>>();
|
List<KeyValuePair<IPEndPoint, Connection>> timedOut = new List<KeyValuePair<IPEndPoint, Connection>>();
|
||||||
foreach (KeyValuePair<IPEndPoint, Connection> pair in Connections) {
|
foreach (KeyValuePair<IPEndPoint, Connection> pair in Connections) {
|
||||||
Connection conn = pair.Value;
|
Connection conn = pair.Value;
|
||||||
@ -190,9 +187,9 @@ namespace NeonTea.Quakeball.Net.Peers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Thread.Sleep((int)Interval);
|
||||||
}
|
}
|
||||||
}
|
} catch (ThreadAbortException) {
|
||||||
} catch (ThreadAbortException e) {
|
|
||||||
Debug.Log("Connection Thread Stopped");
|
Debug.Log("Connection Thread Stopped");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,8 @@ namespace NeonTea.Quakeball.Net.Peers {
|
|||||||
|
|
||||||
private void ListenThreadMethod() {
|
private void ListenThreadMethod() {
|
||||||
try {
|
try {
|
||||||
while (true) {
|
while (Thread.CurrentThread.IsAlive) {
|
||||||
|
if (Peer.UdpClient.Available > 0) {
|
||||||
IPEndPoint Listened = new IPEndPoint(EndPoint.Address, EndPoint.Port);
|
IPEndPoint Listened = new IPEndPoint(EndPoint.Address, EndPoint.Port);
|
||||||
ByteBuffer Buffer = new ByteBuffer();
|
ByteBuffer Buffer = new ByteBuffer();
|
||||||
try {
|
try {
|
||||||
@ -63,7 +64,8 @@ namespace NeonTea.Quakeball.Net.Peers {
|
|||||||
Peer.ConnectionManager.Handle(Listened, Buffer);
|
Peer.ConnectionManager.Handle(Listened, Buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ThreadAbortException e) {
|
}
|
||||||
|
} catch (ThreadAbortException) {
|
||||||
Debug.Log("Listener Thread stopped");
|
Debug.Log("Listener Thread stopped");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,6 +129,7 @@ PlayerSettings:
|
|||||||
preloadedAssets:
|
preloadedAssets:
|
||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
|
- {fileID: 0}
|
||||||
metroInputSource: 0
|
metroInputSource: 0
|
||||||
wsaTransparentSwapchain: 0
|
wsaTransparentSwapchain: 0
|
||||||
m_HolographicPauseOnTrackingLoss: 1
|
m_HolographicPauseOnTrackingLoss: 1
|
||||||
|
Loading…
Reference in New Issue
Block a user