From ada3f4bafd849862d42b21bd023235bc4b99c2e0 Mon Sep 17 00:00:00 2001 From: teascade Date: Wed, 5 Aug 2020 20:45:34 +0300 Subject: [PATCH] Change Connect method --- Assets/Scripts/TeaNet/Peers/Peer.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/TeaNet/Peers/Peer.cs b/Assets/Scripts/TeaNet/Peers/Peer.cs index cdacc0c..cd1f67e 100644 --- a/Assets/Scripts/TeaNet/Peers/Peer.cs +++ b/Assets/Scripts/TeaNet/Peers/Peer.cs @@ -50,9 +50,11 @@ namespace NeonTea.Quakeball.TeaNet.Peers { MessageListener.Message($"Started listening to {endpoint}"); } - public void Connect(string address, int port, byte protocolIdent) { - IPEndPoint listenEndpoint = (IPEndPoint)UdpClient.Client.LocalEndPoint; - StartListen(listenEndpoint); + public void Connect(string address, int port, byte protocolIdent, bool startListening = true) { + if (startListening) { + IPEndPoint listenEndpoint = (IPEndPoint)UdpClient.Client.LocalEndPoint; + StartListen(listenEndpoint); + } IPEndPoint endpoint = new IPEndPoint(FindAddress(address), port); ConnectionManager.StartConnection(endpoint, protocolIdent); MessageListener.Message($"Connecting to {endpoint}");