Ejemplo n.º 1
0
		private ObjectServerImpl(LocalObjectContainer container, ServerConfigurationImpl 
			serverConfig, int port, bool isEmbeddedServer)
		{
			_isEmbeddedServer = isEmbeddedServer;
			_container = container;
			_serverConfig = serverConfig;
			_socketFactory = serverConfig.Networking.SocketFactory;
			_transactionPool = new ClientTransactionPool(container);
			_port = port;
			_name = "db4o ServerSocket FILE: " + container.ToString() + "  PORT:" + _port;
			_container.SetServer(true);
			ConfigureObjectServer();
			_classInfoHelper = new Db4objects.Db4o.CS.Internal.ClassInfoHelper(Db4oClientServerLegacyConfigurationBridge
				.AsLegacy(serverConfig));
			_container.ClassCollection().CheckAllClassChanges();
			bool ok = false;
			try
			{
				EnsureLoadStaticClass();
				StartCommittedCallbackThread(_committedInfosQueue);
				StartServer();
				if (_serverConfig != null)
				{
					_serverConfig.ApplyConfigurationItems(this);
				}
				ok = true;
			}
			finally
			{
				if (!ok)
				{
					Close();
				}
			}
		}
Ejemplo n.º 2
0
        public void Prepare(IConfiguration configuration)
        {
            INetworkingConfiguration networkConfig        = Db4oClientServerLegacyConfigurationBridge.AsNetworkingConfiguration(configuration);
            ISocket4Factory          currentSocketFactory = networkConfig.SocketFactory;

            networkConfig.SocketFactory = new MonitoredSocket4Factory(currentSocketFactory);
        }
Ejemplo n.º 3
0
 public Socket4Adapter(ISocket4Factory socketFactory, string hostName, int port)
 {
     try
     {
         _delegate = socketFactory.CreateSocket(hostName, port);
     }
     catch (IOException e)
     {
         throw new Db4oIOException(e);
     }
 }
Ejemplo n.º 4
0
		public Socket4Adapter(ISocket4Factory socketFactory, string hostName, int port)
		{
			try
			{
				_delegate = socketFactory.CreateSocket(hostName, port);
			}
			catch (IOException e)
			{
				throw new Db4oIOException(e);
			}
		}
Ejemplo n.º 5
0
        private static Thread StartClient(int port, ISocket4Factory factory)
        {
            var clientTread = new Thread(delegate()
            {
                var clientSocket = factory.CreateSocket("localhost", port);
                SendString(clientSocket, Message);
            });

            clientTread.Name = "SslSocketTest thread";
            clientTread.Start();

            return(clientTread);
        }
Ejemplo n.º 6
0
        private void AssertTimeoutBehavior(Thread serverTrigger, int serverTimeout, ISocket4Factory clientSocketFactory)
        {
            ISocket4Factory sslSocketFactory = new SslSocketFactory(new StandardSocket4Factory(), ServerCertificate());
            var             serverSocket     = sslSocketFactory.CreateServerSocket(0);

            serverSocket.SetSoTimeout(serverTimeout);

            serverTrigger.IsBackground = true;
            serverTrigger.Start(serverSocket);

            var clientSocket = clientSocketFactory.CreateSocket("localhost", serverSocket.GetLocalPort());

            if (!serverTrigger.Join(MinutesToMiliseconds(2)))
            {
                serverTrigger.Abort();
                Assert.Fail("Server thread should have timedout.");
            }
        }
        private ObjectServerImpl(LocalObjectContainer container, ServerConfigurationImpl
                                 serverConfig, int port, bool isEmbeddedServer)
        {
            _isEmbeddedServer = isEmbeddedServer;
            _container        = container;
            _serverConfig     = serverConfig;
            _socketFactory    = serverConfig.Networking.SocketFactory;
            _transactionPool  = new ClientTransactionPool(container);
            _port             = port;
            _name             = "db4o ServerSocket FILE: " + container.ToString() + "  PORT:" + _port;
            _container.SetServer(true);
            ConfigureObjectServer();
            _classInfoHelper = new Db4objects.Db4o.CS.Internal.ClassInfoHelper(Db4oClientServerLegacyConfigurationBridge
                                                                               .AsLegacy(serverConfig));
            _container.ClassCollection().CheckAllClassChanges();
            bool ok = false;

            try
            {
                EnsureLoadStaticClass();
                StartCommittedCallbackThread(_committedInfosQueue);
                StartServer();
                if (_serverConfig != null)
                {
                    _serverConfig.ApplyConfigurationItems(this);
                }
                ok = true;
            }
            finally
            {
                if (!ok)
                {
                    Close();
                }
            }
        }
Ejemplo n.º 8
0
 public PassThroughSocketFactory()
 {
     _delegating = new StandardSocket4Factory();
 }
Ejemplo n.º 9
0
 public PassThroughSocketFactory(ISocket4Factory delegating)
 {
     _delegating = delegating;
 }
Ejemplo n.º 10
0
		public PassThroughSocketFactory(ISocket4Factory delegating)
		{
			_delegating = delegating;	
		}
Ejemplo n.º 11
0
 public SslSocketFactory(ISocket4Factory delegating, X509Certificate2 certificate)
 {
     _certificate = certificate;
     _delegating  = delegating;
 }
Ejemplo n.º 12
0
 public CountingSocket4Factory(ISocket4Factory socketFactory)
 {
     _socketFactory = socketFactory;
 }
Ejemplo n.º 13
0
 public MonitoredSocket4Factory(ISocket4Factory socketFactory)
 {
     _socketFactory = socketFactory;
 }
		public SslSocketFactory(ISocket4Factory delegating, X509Certificate2 certificate)
		{
			_certificate = certificate;
			_delegating = delegating;
		}
Ejemplo n.º 15
0
 public PassThroughSocketFactory()
 {
     _delegating = new StandardSocket4Factory();
 }
Ejemplo n.º 16
0
 public MonitoredSocket4Factory(ISocket4Factory socketFactory)
 {
     _socketFactory = socketFactory;
 }
Ejemplo n.º 17
0
		private static Thread StartClient(int port, ISocket4Factory factory)
		{
			Thread clientTread = new Thread(delegate()
			{
				ISocket4 clientSocket = factory.CreateSocket("localhost", port);
				SendString(clientSocket, Message);
			});

			clientTread.Name = "SslSocketTest thread";
			clientTread.Start();

			return clientTread;
		}
Ejemplo n.º 18
0
		private void AssertTimeoutBehavior(Thread serverTrigger, int serverTimeout, ISocket4Factory clientSocketFactory)
		{
			ISocket4Factory sslSocketFactory = new SslSocketFactory(new StandardSocket4Factory(), ServerCertificate());
			IServerSocket4 serverSocket = sslSocketFactory.CreateServerSocket(0);
			serverSocket.SetSoTimeout(serverTimeout);

			serverTrigger.IsBackground = true;
			serverTrigger.Start(serverSocket);

			ISocket4 clientSocket = clientSocketFactory.CreateSocket("localhost", serverSocket.GetLocalPort());

			if (!serverTrigger.Join(MinutesToMiliseconds(2)))
			{
				serverTrigger.Abort();
				Assert.Fail("Server thread should have timedout.");
			}
		}
Ejemplo n.º 19
0
		public CountingSocket4Factory(ISocket4Factory socketFactory)
		{
			_socketFactory = socketFactory;
		}
		public SslSocketFactory(ISocket4Factory delegating, RemoteCertificateValidationCallback validationCallback)
		{
			_delegating = delegating;
			_validationCallback = validationCallback;
		}
Ejemplo n.º 21
0
 public SslSocketFactory(ISocket4Factory delegating, RemoteCertificateValidationCallback validationCallback)
 {
     _delegating         = delegating;
     _validationCallback = validationCallback;
 }