//"Accept" incoming constructor internal NetPeer(NetManager netManager, IPEndPoint remoteEndPoint, int id, long connectId, byte connectNum) : this(netManager, remoteEndPoint, id) { _connectTime = connectId; _connectionState = ConnectionState.Connected; ConnectionNum = connectNum; //Make initial packet _connectAcceptPacket = NetConnectAcceptPacket.Make(_connectTime, connectNum, false); //Send NetManager.SendRaw(_connectAcceptPacket, EndPoint); NetDebug.Write(NetLogLevel.Trace, "[CC] ConnectId: {0}", _connectTime); }
internal bool ProcessConnectAccept(NetConnectAcceptPacket packet) { if (_connectionState != ConnectionState.Outgoing) { return(false); } //check connection id if (packet.ConnectionId != _connectTime) { NetDebug.Write(NetLogLevel.Trace, "[NC] Invalid connectId: {0}", _connectTime); return(false); } //check connect num ConnectionNum = packet.ConnectionNumber; NetDebug.Write(NetLogLevel.Trace, "[NC] Received connection accept"); _timeSinceLastPacket = 0; _connectionState = ConnectionState.Connected; return(true); }