Exemple #1
0
	public ClientNode( CommonNodeSettings commonSettings, ClientNodeSettings clientSettings ) : base( commonSettings )
	{
		_clientSettings = clientSettings;
		_localIndex = new NodeIndex(); // ensure this is invalid
		_status = Status.NotStarted;

		_entity = new EntitySet( 64 );
	}
Exemple #2
0
	// PROTECTED

	protected CommonNode( CommonNodeSettings commonSettings )
	{
		_commonSettings = commonSettings;

		Log.s_logLevel = _commonSettings.logLevel;

		// network time and _localIndex must be setup by child classes
		// these are just default invalid values.
		_networkTime = -1f;
		_localIndex = new NodeIndex();

		int bufferLength = GetMaxMessageLength();
		BitReader protoReader = new BitReader( new DataStream( bufferLength ) );
		BitWriter protoWriter = new BitWriter( new DataStream( bufferLength ) );
		_readerPool = new FixedPool<BitReader>( protoReader, BIT_POOL_CAPACITY );
		_writerPool = new FixedPool<BitWriter>( protoWriter, BIT_POOL_CAPACITY );
	}
	public ServerNode( CommonNodeSettings commonSettings, ServerNodeSettings serverSettings ) : base( commonSettings )
	{
		_serverSettings = serverSettings;
		_isRunning = false;

		_networkTime = 0f;
		_localIndex = NodeIndex.SERVER_NODE_INDEX;

		_entity = new EntitySet( 64 );
		_entityCounter = 0;
		_conductCounter = 0;

		_connection = new ConnectionSet( _serverSettings.maxConnections );

		// TODO: cozeroff
		/* 
		eventOvershootCounter = 0f;
		
		try
		{
			if (server && !string.IsNullOrEmpty(config.ServerBase64PfxCertificate))
			{
				config.ServerX509Certificate = new X509Certificate2(Convert.FromBase64String(config.ServerBase64PfxCertificate));
				if (!config.ServerX509Certificate.HasPrivateKey)
				{
					Log.Warn("The imported PFX file did not have a private key");
				}
			}
		}
		catch (CryptographicException ex)
		{
			Log.Error("Importing of certificate failed: " + ex.ToString());
		}
		*/
		
	}