Example #1
0
void AuxService::run()
{
  INFO_PRINT << "Starting Aux Listener (" << _scriptdef.relativename() << ", port " << _port << ")\n";

  Clib::SocketListener listener( _port );
  while ( !Clib::exit_signalled )
  {
    if ( listener.GetConnection( 5 ) )
    {
      Core::PolLock lock;
#ifdef PERGON
      // TODO remove the ifdef it works..
      AuxClientThread* client( new AuxClientThread( this, listener ) );
      Core::networkManager.auxthreadpool->push( [client]()
      {
        std::unique_ptr<AuxClientThread> _clientptr( client );
        _clientptr->run();
      } );
#else
      Clib::SocketClientThread* clientthread = new AuxClientThread( this, listener );
      clientthread->start();
      // note SocketClientThread::start deletes the SocketClientThread upon thread exit.
#endif
    }
  }
}
Example #2
0
	void AuxService::run()
	{
      INFO_PRINT << "Starting Aux Listener (" << _scriptdef.relativename() << ", port " << _port << ")\n";

	  Clib::SocketListener listener( _port );
	  while ( !Clib::exit_signalled )
	  {
		if ( listener.GetConnection( 5 ) )
		{
          Core::PolLock lock;
		  // Shinigami: Just 4 Debugging. We got Crashes here...
#ifdef PERGON
		  ERROR_PRINT << "Aux Listener (" << _scriptdef.relativename() << ", port " << _port << ") - add task\n";
          AuxClientThread* client( new AuxClientThread( this, listener ) );
          Core::networkManager.auxthreadpool->push( [client]()
          {
            std::unique_ptr<AuxClientThread> _clientptr( client );
            _clientptr->run();
          } );
          ERROR_PRINT << "AuxWorkerSize: " << Core::networkManager.auxthreadpool->threadpoolsize() << "\n";
#else
		  Clib::SocketClientThread* clientthread = new AuxClientThread( this, listener );
		  clientthread->start();
		  // note SocketClientThread::start deletes the SocketClientThread upon thread exit.
#endif
		}
	  }
	}