mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-12-11 20:15:10 +01:00
disconnect with ctrl c
This commit is contained in:
parent
8d239a41b5
commit
d03ad707cd
@ -58,19 +58,7 @@ public class Client
|
|||||||
}
|
}
|
||||||
|
|
||||||
_transport.Log($"connecting to {address}");
|
_transport.Log($"connecting to {address}");
|
||||||
var options = new SteamNetworkingConfigValue_t[]
|
_conn = SteamNetworkingSockets.ConnectByIPAddress(ref steamAddr, 0, new SteamNetworkingConfigValue_t[0]);
|
||||||
{
|
|
||||||
new SteamNetworkingConfigValue_t
|
|
||||||
{
|
|
||||||
m_eValue = ESteamNetworkingConfigValue.k_ESteamNetworkingConfig_IP_AllowWithoutAuth,
|
|
||||||
m_eDataType = ESteamNetworkingConfigDataType.k_ESteamNetworkingConfig_Int32,
|
|
||||||
m_val = new SteamNetworkingConfigValue_t.OptionValue
|
|
||||||
{
|
|
||||||
m_int32 = 1,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
_conn = SteamNetworkingSockets.ConnectByIPAddress(ref steamAddr, options.Length, options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Send(ArraySegment<byte> segment, int channelId)
|
public void Send(ArraySegment<byte> segment, int channelId)
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using Steamworks;
|
using Steamworks;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace SteamTransport;
|
namespace SteamTransport;
|
||||||
@ -77,7 +75,13 @@ public static class Program
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while (true)
|
var running = true;
|
||||||
|
Console.CancelKeyPress += (sender, args) =>
|
||||||
|
{
|
||||||
|
args.Cancel = true;
|
||||||
|
running = false;
|
||||||
|
};
|
||||||
|
while (running)
|
||||||
{
|
{
|
||||||
transport.ServerEarlyUpdate();
|
transport.ServerEarlyUpdate();
|
||||||
SteamAPI.RunCallbacks();
|
SteamAPI.RunCallbacks();
|
||||||
@ -103,15 +107,18 @@ public static class Program
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var stopwatch = Stopwatch.StartNew();
|
var running = true;
|
||||||
while (true)
|
Console.CancelKeyPress += (sender, args) =>
|
||||||
|
{
|
||||||
|
args.Cancel = true;
|
||||||
|
running = false;
|
||||||
|
};
|
||||||
|
while (running)
|
||||||
{
|
{
|
||||||
transport.ClientEarlyUpdate();
|
transport.ClientEarlyUpdate();
|
||||||
SteamAPI.RunCallbacks();
|
SteamAPI.RunCallbacks();
|
||||||
transport.ClientLateUpdate();
|
transport.ClientLateUpdate();
|
||||||
Thread.Sleep(10);
|
Thread.Sleep(10);
|
||||||
|
|
||||||
if (stopwatch.ElapsedMilliseconds > 10 * 1000) break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@ -52,17 +52,11 @@ public class Server
|
|||||||
|
|
||||||
public void Send(int connectionId, ArraySegment<byte> segment, int channelId) { }
|
public void Send(int connectionId, ArraySegment<byte> segment, int channelId) { }
|
||||||
|
|
||||||
public void RecieveData()
|
public void RecieveData() { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Flush()
|
public void Flush() { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Disconnect(int connectionId)
|
public void Disconnect(int connectionId) { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user