Gwupe.Communication.P2P.RUDP.Tunnel.Transport.TCPTransport.GetNextConnectionId C# (CSharp) Method

GetNextConnectionId() private method

private GetNextConnectionId ( ) : byte
return byte
        private byte GetNextConnectionId()
        {
            lock (_lastConnectionLock)
            {
                byte saveLast = _lastConnectionId;
                while (_tcpConnections.IsLocalOpenConnection(++_lastConnectionId))
                {
                    if (_lastConnectionId != saveLast)
                    {
                        throw new ConnectionException("Cannot get next connection id, all connections in use");
                    }
                }
            }
            Logger.Debug("Found next connection id " + _lastConnectionId);
            return _lastConnectionId;
        }