Exemplo n.º 1
0
	IAudioSource* cAudioManager::createAudioSource(IAudioDecoder* decoder, const cAudioString& audioName, const cAudioString& dataSource)
	{
        if (!decoder)
            return NULL;
        
		if(decoder->isValid())
		{
#if CAUDIO_EFX_ENABLED == 1
			IAudioSource* audio = CAUDIO_NEW cAudioSource(decoder, AudioContext, ((cAudioEffects*)getEffects())->getEFXInterface());
#else
			IAudioSource* audio = CAUDIO_NEW cAudioSource(decoder, AudioContext);
#endif
			decoder->drop();

			if(audio && audio->isValid())
			{
				if(!audioName.empty())
					audioIndex[audioName] = audio;

				audioSources.push_back(audio);		
				getLogger()->logInfo("AudioManager", "Audio Source (%s) created from Data Source %s.", toUTF8(audioName), toUTF8(dataSource));
				return audio;
			}

			getLogger()->logError("AudioManager", "Failed to create Audio Source (%s): Error creating audio source.", toUTF8(audioName));
			audio->drop();
			return NULL;
		}
		getLogger()->logError("AudioManager", "Failed to create Audio Source (%s): Audio data could not be decoded by (.%s) decoder.",
                              toUTF8(audioName), toUTF8(decoder->getType()));
		decoder->drop();
		return NULL;
	}
Exemplo n.º 2
0
void
Library<T>::remove( T* pointer )
{

    bool found = false;
    size_t ix;

    // First, try searching by ID
    const std::string id = pointer->id();
    if( !id.empty() ) {
        // It has an ID, remove from map
        auto it = m_map.find(id );
        if( it != m_map.end() ) {
            found = true;
            ix = it->second;
            m_map.erase( it );
#ifdef DEBUG
            if( m_objects[ix] != pointer ) {
                Logger log = getLogger( m_instance_name + ".remove" );
                SCENELOG_ERROR( log, "Pointer and ID mismatch (id='" << id << "')." );
                found = false;
            }
#endif
        }
    }

    // Then, try searching by address
    if(!found) {
        for( size_t i=0; i<m_objects.size(); i++ ) {
            if( m_objects[i] == pointer ) {
                ix = i;
                found = true;
                break;
            }
        }
    }

    if( !found ) {
        Logger log = getLogger( m_instance_name + ".remove" );
        SCENELOG_WARN( log, "Pointer " << pointer << " not found." );
        return;
    }

    m_objects[ ix ] = m_objects.back();
    m_objects.resize( m_objects.size()-1 );

    // Update map
    for(auto it=m_map.begin(); it!=m_map.end(); ++it ) {
        if( it->second == m_objects.size() ) {
            it->second = ix;
        }
    }

    // Remove object
    delete pointer;

    touchStructureChanged();
    m_database->moveForward( *this );
}
Exemplo n.º 3
0
void Service::deploy(TechniqueService& technique)
{
  const std::string& urn = technique.getUrn();

  _mutex.acquire();

  if (_deployedTechniqueServices.find(urn) == _deployedTechniqueServices.end()) {
    _deployedTechniqueServices[urn] = &technique;

    getLogger().info(CONTAINER_SERVICE, "Technique " + urn + " deployed");

    try {
      nameservice::Client client(80001);
      client.addLocation(urn, "localhost");

      getLogger().info(CONTAINER_SERVICE, "Remote addition of technique " + urn + " successful");
      getLogger().info(CONTAINER_SERVICE, "Technique " + urn + " is externally accessible");

    } catch (nameservice::Exception& ex) {
      getLogger().info(CONTAINER_SERVICE, "Remote addition of technique " + urn + " failed");
      getLogger().info(CONTAINER_SERVICE, ex.getMessage());
      getLogger().info(CONTAINER_SERVICE, "Technique " + urn + " not accessible externally (only locally from this host)");

    } catch (net::Exception& ex) {
      getLogger().info(CONTAINER_SERVICE, "Remote addition of technique " + urn + " failed");
      getLogger().info(CONTAINER_SERVICE, ex.getMessage());
      getLogger().info(CONTAINER_SERVICE, "Technique " + urn + " not accessible externally (only locally from this host)");

    }

  }

  _mutex.release();

}
Exemplo n.º 4
0
int JConn::processPacketHeader( unsigned char * &p )
{
    if (( *p != AJP_RESP_PREFIX_B1)||
        ( *(p+1) != AJP_RESP_PREFIX_B2 ))
    {
        LOG_ERR(( getLogger(), "[%s] Invalid AJP response signature %x%x",
                    getLogId(), (int) *p,
                    (int) *(p+1) ));
        return -1;
    }
    p+= 2;
    m_curPacketSize = getInt( p );
    if ( m_curPacketSize > AJP_MAX_PKT_BODY_SIZE )
    {
        LOG_ERR(( getLogger(), "[%s] packet size is too large - %d",
                getLogId(), m_curPacketSize ));
        return -1;
    }
    m_packetType = *p++;
    m_packetLeft = m_curPacketSize - 1;
    switch(m_packetType)
    {
    case AJP13_RESP_BODY_CHUNK:
        m_iPacketState = CHUNK_LEN;
        break;
    case AJP13_RESP_HEADERS:
        m_iPacketState = STATUS_CODE;
        break;
    case AJP13_END_RESP:
        if ( *p != 1)
        {
            if ( D_ENABLED( DL_LESS ) )
                LOG_D(( getLogger(),
                    "[%s] close connection required by servlet engine %s ",
                    getLogId(), getWorker()->getURL() ));
            
            setState( CLOSING );
        }
        p++;
        if ( getConnector() )
        {
            incReqProcessed();
            if ( getState() == ABORT )
                setState( PROCESSING );
            setInProcess( 0 );            
            getConnector()->endResponse( 0, 0 );
        }
        break;
    case AJP13_MORE_REQ_BODY:
    default:
        break;
    }
    return 0;    
}
bool SimpleForwardingModule::setupDatabase() {
    bool result = false;

    DeviceModule_Proto::Request reqContainerMsg; // container message
    DeviceModule_Proto::Request_GetAllDevicesRequest* reqMsg =
            new DeviceModule_Proto::Request_GetAllDevicesRequest(); // getAllDevices message
    reqContainerMsg.set_allocated_get_all_devices_request(reqMsg);


    DeviceModule_Proto::Reply replyMsg;
    zsdn::RequestUtils::RequestResult requestResult =
            zsdn::RequestUtils::sendRequest(*getZmf(),
                                            reqContainerMsg,
                                            replyMsg,
                                            getAllDevicesMsgTopic_,
                                            zsdn::MODULE_TYPE_ID_DeviceModule,
                                            deviceMgrDependencyVersion_);

    switch (requestResult) {
        case zsdn::RequestUtils::SUCCESS: {
            // clean up all device inside the map
            this->devices_.clear();
            int containedDevices = replyMsg.get_all_devices_reply().devices().size();
            // iterate over all devices inside the message and insert them to the devices map.
            for (int counter = 0; counter < containedDevices; counter++) {
                common::topology::Device msgDevice = replyMsg.get_all_devices_reply().devices().Get(counter);
                this->insertNewDevice(msgDevice.mac_address(), msgDevice.attachment_point().switch_dpid(),
                                      msgDevice.attachment_point().switch_port());
            }
            result = true; // successful setup the devices database
        }
            break;
        case zsdn::RequestUtils::TIMEOUT:
            getLogger().information("request getAllDevices timed out.");
            break;
        case zsdn::RequestUtils::NO_MODULE_INSTANCE_FOUND:
            getLogger().warning("No module with type zsdn::MODULE_TYPE_ID_DeviceModule found (DeviceModule).");
            break;
        case zsdn::RequestUtils::REQUEST_SERIALIZATION_FAILED:
            getLogger().warning("Serialization of the Request failed.");
            break;
        case zsdn::RequestUtils::RESPONSE_PARSE_FAILED:
            getLogger().warning("Parsing of the Response failed.");
            break;
    }

    return result;
};
Exemplo n.º 6
0
	void cAudioCapture::updateCaptureBuffer(bool force)
	{
		cAudioMutexBasicLock lock(Mutex);
		if(Capturing && CaptureDevice && Ready)
		{
			int AvailableSamples = 0;
			alcGetIntegerv(CaptureDevice, ALC_CAPTURE_SAMPLES, 1, &AvailableSamples);
			const unsigned int availbuffersize = AvailableSamples * SampleSize;

			//If the samples in the OpenAL buffer are more than half of its max size, grab them
			if(availbuffersize > InternalBufferSize / 2 || force)
			{
				//Fixes a bug with the capture being forced, but no data being available
				if(availbuffersize > 0)
				{
					const unsigned int oldBufferSize = CaptureBuffer.size();
					CaptureBuffer.resize(oldBufferSize + availbuffersize, 0);
					alcCaptureSamples(CaptureDevice, &CaptureBuffer[oldBufferSize], AvailableSamples);
					checkError();
					getLogger()->logDebug("AudioCapture", "Captured %i bytes of audio data.", availbuffersize);
					signalEvent(ON_UPDATE);
				}
			}
		}
	}
Exemplo n.º 7
0
Index* BPlusIndex::findIndex(IndexPage* start, djondb::string key) const {
	Logger* log = getLogger(NULL);
	for (int x = 0; x < start->size; x++) {
		Index* current = start->elements[x];
		//INDEXPOINTERTYPE testKey = current->key->toChar();
		djondb::string testKey = current->key->getDJString("_id");
		int result = testKey.compare(key);
		//free(testKey);

		if (result < 0) {
			if (start->pointers[x] != NULL) {
				return findIndex(start->pointers[x], key);
			} else {
				return NULL;
			}
		} if (result == 0) {
			return current;
		}
	}
	if (start->pointers[start->size] != NULL) {
		return findIndex(start->pointers[start->size], key);
	} else {
		return NULL;
	}
}
Exemplo n.º 8
0
	void cPluginManager::uninstallPlugin(IAudioPlugin* plugin)
	{
		if(plugin)
		{
			RegisteredPluginsIterator it;
			for(it = RegisteredPlugins.begin(); it != RegisteredPlugins.end(); it++)
			{
				if(it->second == plugin)
				{
					RegisteredPlugins.erase(it->first);
					break;
				}
			}

			DynamicallyLoadedPluginsIterator it2 = DynamicallyLoadedPlugins.find(plugin);
			if(it2 != DynamicallyLoadedPlugins.end())
			{
				//Found a plugin we loaded from the filesystem, unload it and delete the plugin
				it2->first->drop();
				if(DYNLIB_UNLOAD(it2->second))
				{
					getLogger()->logError("cPluginManager", "Plugin Error: %s.", getError().c_str());
				}
				DynamicallyLoadedPlugins.erase(it2->first);
			}
		}
	}
Exemplo n.º 9
0
	void cAudioManager::shutDown()
	{
		if(Initialized)
		{
			if (AudioThread) // First wait for our update thread to finish up
			{
				AudioThread->join();
				delete AudioThread;
				AudioThread = NULL;
			} 

			cAudioMutexBasicLock lock(Mutex);

			releaseAllSources();
			
			if (AudioContext)
			{
				AudioContext->shutDown();
				CAUDIO_DELETE AudioContext;
				AudioContext = NULL;
			}

			Initialized = false;

			getLogger()->logInfo("AudioManager", "Manager successfully shutdown.");
		}
	}
Exemplo n.º 10
0
int L4Handler::init(HttpReq &req, const GSockAddr *pGSockAddr, const char *pIP, int iIpLen)
{
    int ret = m_pL4conn->init(pGSockAddr);
    if (ret != 0)
        return ret;
    
    int hasSlashR = 1; //"\r\n"" or "\n"
    LoopBuf *pBuff = m_pL4conn->getBuf();
    pBuff->append(req.getOrgReqLine(), req.getHttpHeaderLen());
    char *pBuffEnd = pBuff->end();
    assert(pBuffEnd[-1] == '\n');
    if (pBuffEnd[-2] == 'n')
        hasSlashR = 0;
    else
    {
        assert(pBuffEnd[-2] == '\r');
    }
    
    pBuff->used( -1 * hasSlashR - 1);
    pBuff->append("X-Forwarded-For", 15);
    pBuff->append(": ", 2);
    pBuff->append(pIP, iIpLen);
    if (hasSlashR)
        pBuff->append("\r\n\r\n", 4);
    else
        pBuff->append("\n\n", 2);
    
    continueRead();
    if ( D_ENABLED( DL_LESS ) )
    {
        LOG_D ((getLogger(), "[%s] L4Handler: init web socket, reqheader [%s], len [%d]",
                getLogId(), req.getOrgReqLine(), req.getHttpHeaderLen() ));
    }
    return 0;
}
Exemplo n.º 11
0
void LoggingUnitTest::checkDefaultStatusTest(void) {
    Logging::Logger::LoggerSmartPtr testLoggerSmartPtr = getLogger();
    testLoggerSmartPtr->setName("testLogger");
    
    if(getenv("LOCATION")) { CPPUNIT_ASSERT(!testLoggerSmartPtr->stats.getDisableStatistics()); }
    else { CPPUNIT_ASSERT(testLoggerSmartPtr->stats.getDisableStatistics()); }
}
Exemplo n.º 12
0
IndexPage* BPlusIndexP::findIndexPage(IndexPage* start, djondb::string key) {
	Logger* log = getLogger(NULL);
	if (!start->isLoaded()) {
		start->loadPage(_bufferManager);
	}
	if (start->isLeaf()) {
		return start;
	} else {
		for (int x = 0; x < start->size; x++) {
			Index* current = start->elements[x];
			//INDEXPOINTERTYPE testKey = current->key->toChar();
			djondb::string testKey = current->key->getDJString("_id");
			int result = testKey.compare(key);
			//free(testKey);

			if (result < 0) {
				if (start->pointers[x] != NULL) {
					return findIndexPage(start->pointers[x], key);
				} else {
					return start;
				}
			}
		}
		if (start->pointers[start->size] != NULL) {
			return findIndexPage(start->pointers[start->size], key);
		} else {
			return start;
		}
	}
}
Exemplo n.º 13
0
NetworkInputStream::NetworkInputStream(const NetworkInputStream& orig) {
	_buffer = orig._buffer;
	this->_bufferPos = orig._bufferPos;
	this->_bufferSize = orig._bufferSize;
	this->_socket = orig._socket;
	_logger = getLogger(NULL);
}
Exemplo n.º 14
0
void IndexPage::debugElements() const {
	Logger* log = getLogger(NULL);
	if (log->isDebug()) {

		std::stringstream ss;
		for (int x = 0; x < size; x++) {
			if (pointers[x] == NULL) {
				ss << " (NULL) ";
			} else {
				ss << " (" << (long)pointers[x] << ") ";
			}
			if (elements[x] != NULL) {
				ss << " <<" << (long) elements[x] << ">> " << (const char*)elements[x]->key->getDJString("_id");
			} else {
				ss << " << NULL >> ";
			}
		}
		if (pointers[size] != NULL) {
			ss << " (" << (long)pointers[size] << ") ";
		} else {
			ss << " (NULL) ";
		}
		std::string s = ss.str();
		log->debug("%s", s.c_str());
	}
}
Exemplo n.º 15
0
//begin public api.
Lav_PUBLIC_FUNCTION LavError Lav_setLoggingCallback(LavLoggingCallback cb) {
	PUB_BEGIN
	implicitInitLogging();
	getLogger()->setLoggingCallback([=] (logger_singleton::LogMessage &msg) {logCallbackTranslator(msg, cb);});
	saved_logging_callback.store(cb);
	PUB_END
}
Exemplo n.º 16
0
int findInsertPositionArray(Index** elements, Index* index, int len, int size) {
	Logger* log = getLogger(NULL);
	int indexPositionResult = 0;
	if (len == 0) {
		return 0;
	} else {
		int res;
//		INDEXPOINTERTYPE key = index->key->toChar();
		djondb::string key = index->key->getDJString("_id");
		bool found = false;
		for (int x = 0; x < size; x++) {
			Index* current = elements[x];
			indexPositionResult = x;
			if (current == NULL) {
				found = true;
				break;
			} else {
	djondb::string currentKey = current->key->getDJString("_id");
	//			INDEXPOINTERTYPE currentKey = current->key->toChar();
				int res = currentKey.compare(key); 
				//free(currentKey);
				if (res < 0) {
					found = true;
					break;
				}
			}
		}
		if (!found) {
			indexPositionResult++;
		}
		//free(key);
	}
	return indexPositionResult;
}
Exemplo n.º 17
0
	IAudioSource* cAudioManager::createFromRaw(const char* name, const char* data, size_t length, unsigned int frequency, AudioFormats format)
	{
		if(!Initialized) return NULL;

		cAudioMutexBasicLock lock(Mutex);
		cAudioString audioName = safeCStr(name);
		IAudioDecoderFactory* factory = getAudioDecoderFactory("raw");

		if(!factory) {
			getLogger()->logError("AudioManager", "Failed to create Audio Source (%s): Codec (.raw) is not supported.", audioName.c_str());
			return NULL;
		}

		cMemorySource* source = CAUDIO_NEW cMemorySource(data, length, true);
		if(source && source->isValid())
		{
			IAudioDecoder* decoder = ((cRawAudioDecoderFactory*)factory)->CreateAudioDecoder(source, frequency, format);
			source->drop();

			IAudioSource* audio = createAudioSource(decoder, audioName, "cMemorySource");
			if(audio != NULL)
				return audio;

			if(source)
				source->drop();
		}
		return NULL;
	}
Exemplo n.º 18
0
    IAudioSource* cAudioManager::createFromMemory(const char* name, const char* data, size_t length, const char* extension)
    {
		if(!Initialized) return NULL;

		cAudioMutexBasicLock lock(Mutex);
		cAudioString audioName = safeCStr(name);
		cAudioString ext = safeCStr(extension);
		IAudioDecoderFactory* factory = getAudioDecoderFactory(ext.c_str());

		if(!factory) {
			getLogger()->logError("AudioManager", "Failed to create Audio Source (%s): Codec (.%s) is not supported.", audioName.c_str(), ext.c_str());
			return NULL;
		}

		cMemorySource* source = CAUDIO_NEW cMemorySource(data, length, true);
		if(source && source->isValid())
		{
			IAudioDecoder* decoder = factory->CreateAudioDecoder(source);
			source->drop();

			IAudioSource* audio = createAudioSource(decoder, audioName, "cMemorySource");
			if(audio != NULL)
				return audio;

			if(source)
				source->drop();
		}
		return NULL;
    }
Exemplo n.º 19
0
static uavcan_linux::NodePtr initMainNode(const std::vector<std::string>& ifaces, uavcan::NodeID nid,
                                          const std::string& name)
{
    std::cout << "Initializing main node" << std::endl;

    auto node = uavcan_linux::makeNode(ifaces);

    node->setNodeID(nid);
    node->setName(name.c_str());

    node->getLogger().setLevel(uavcan::protocol::debug::LogLevel::DEBUG);

    const int start_res = node->start();
    ENFORCE(0 == start_res);

    uavcan::NetworkCompatibilityCheckResult init_result;
    ENFORCE(0 == node->checkNetworkCompatibility(init_result));
    if (!init_result.isOk())
    {
        throw std::runtime_error("Network conflict with node " + std::to_string(init_result.conflicting_node.get()));
    }

    node->setStatusOk();
    return node;
}
Exemplo n.º 20
0
bool
RenderShader::compileShader( GLuint shader, const std::string& source )
{
    Logger log = getLogger( package + ".compileShader" );

    const char* src = source.c_str();
    glShaderSource( shader, 1, &src, NULL );
    glCompileShader( shader );

    GLint status;
    glGetShaderiv( shader, GL_COMPILE_STATUS, &status );

    GLint loglength;
    glGetShaderiv( shader, GL_INFO_LOG_LENGTH, &loglength );

    if( (status != GL_TRUE) || (loglength>1) ) {
        RL_LOG_ERROR( log, "shader source:" << std::endl << source );
    }
    if( loglength > 1 ) {
        std::vector<GLchar> clog( loglength );
        glGetShaderInfoLog( shader, loglength, NULL, &clog[0] );
        RL_LOG_ERROR( log, "compilation log:" << std::endl << &clog[0] );
    }
    if( status != GL_TRUE ) {
        RL_LOG_ERROR( log, "Compilation failed" );
    }
    CHECK_GL;
    return status == GL_TRUE;
}
Exemplo n.º 21
0
bool ConcreteDatabase::directExecuteStmt( const SqlStatementID& id, SqlStmtParameters& params )
{
	//execute statement
	SqlConnection& conn = getAsyncConnection();
	SqlConnection::Lock guard(conn);

	return Retry::SqlOp<bool>(getLogger(),[&](SqlConnection& c){ return c.executeStmt(id, params); })(conn,"DirectStmtExec",[&](){ return conn.getStmt(id)->getSqlString(true); });
}
Exemplo n.º 22
0
    bool cAudioManager::registerAudioDecoder(IAudioDecoderFactory* factory, const char* extension)
    {
		cAudioMutexBasicLock lock(Mutex);
		cAudioString ext = safeCStr(extension);
        decodermap[ext] = factory;
		getLogger()->logInfo("AudioManager", "Audio Decoder for extension .%s registered.", ext.c_str());
		return true;
    }
void LLVMModelDataSymbols::initBoundarySpecies(const libsbml::Model* model)
{
    const ListOfSpecies *species = model->getListOfSpecies();
    list<string> indBndSpecies;
    list<string> depBndSpecies;

    // get the boundary species

    for (uint i = 0; i < species->size(); ++i)
    {
        const Species *s = species->get(i);
        if (s->getBoundaryCondition())
        {
            if (isIndependentElement(s->getId()))
            {
                indBndSpecies.push_back(s->getId());
            }
            else
            {
                depBndSpecies.push_back(s->getId());
            }
        }
    }

    // stuff the species in the map
    for (list<string>::const_iterator i = indBndSpecies.begin();
            i != indBndSpecies.end(); ++i)
    {
        uint bi = boundarySpeciesMap.size();
        boundarySpeciesMap[*i] = bi;
    }

    for (list<string>::const_iterator i = depBndSpecies.begin();
            i != depBndSpecies.end(); ++i)
    {
        uint bi = boundarySpeciesMap.size();
        boundarySpeciesMap[*i] = bi;
    }

    // finally set how many we have
    independentBoundarySpeciesSize = indBndSpecies.size();

    if (Logger::PRIO_INFORMATION <= getLogger().getLevel())
    {
        LoggingBuffer log(Logger::PRIO_INFORMATION, __FILE__, __LINE__);

        log.stream() << "found "
                << indBndSpecies.size() << " independent and "
                << depBndSpecies.size() << " dependent boundary species."
                << endl;

        vector<string> ids = getBoundarySpeciesIds();
        for (uint i = 0; i < ids.size(); ++i)
        {
            log.stream() << "boundary species [" << i << "] = \'" << ids[i] << "\'" << endl;
        }
    }
}
Exemplo n.º 24
0
	void SoundEngineOpenAL::destroy()
	{
		// Stop thread
		running = false;
		while (!threadstopped)
			usleep(1000);
		// Delete listener
		if (listener)
			delete listener;
		// Delete recorders
		while (recorders.size() != 0)
			recorders[0]->destroy();
		// Delete sources
		std::map<std::string, SoundSource*>::iterator it = sources.begin();
		while (it != sources.end())
		{
			it->second->drop();
			it++;
		}
		// Delete sounds
		for (unsigned int i = 0; i < sounds.size(); i++)
		{
			sounds[i]->drop();
		}
		sounds.clear();
		// Destroy OpenAL context
		unsigned int error = alGetError();
		if (error != AL_NO_ERROR)
		{
			getLogger()->write(ELL_Error, "AL error on exit: %s!\n",
				getOpenALErrorString(error));
		}
		ALCcontext *context = alcGetCurrentContext();
		ALCdevice *dev = alcGetContextsDevice(context);
		error = alcGetError(dev);
		if (error != AL_NO_ERROR)
		{
			getLogger()->writeLine(ELL_Error, "ALC error on exit!\n");
		}
		alcMakeContextCurrent(0);
		alcDestroyContext(context);
		alcCloseDevice(dev);
		// Delete engine instance
		delete this;
	}
Exemplo n.º 25
0
int LsapiConn::sendAbortReq()
{
    if ( D_ENABLED( DL_LESS ) )
        LOG_D(( getLogger(), "[%s] [LSAPI] send abort packet!",
            getLogId() ));
    lsapi_packet_header rec;
    LsapiReq::buildPacketHeader( &rec, LSAPI_ABORT_REQUEST, LSAPI_PACKET_HEADER_LEN );
    return write( (char *)&rec, sizeof( rec ) );
}
Exemplo n.º 26
0
NetworkInputStream::NetworkInputStream(int clientSocket)
{
	_socket = clientSocket;
	_buffer = (char*) malloc(STREAM_BUFFER_SIZE);
	_bufferPos = 0;
	_bufferSize = 0;
	_open = true;
	_logger = getLogger(NULL);
}
Exemplo n.º 27
0
int FcgiRequest::sendAbortRec( )
{
    if ( D_ENABLED( DL_LESS ) )
        LOG_D(( getLogger(), "[%s] [FCGI] send abort packet!",
            getConnector()->getLogId() ));
    FCGI_Header rec;
    FcgiRecord::setRecordHeader( rec, FCGI_ABORT_REQUEST, m_iId, 0 );
    return m_pFcgiConn->sendRecord( (const char *)&rec, sizeof( rec ) );
}
Exemplo n.º 28
0
void IOServiceLibEvent::onReadTimeout(int fd, short event, void* arg)
{
	ConnectorChannelContext* ctx = (ConnectorChannelContext*) arg;

	getLogger().trace("IOServiceLibEvent::onReadTimeout(%d, %d, %s)\n", fd,
			event, ctx->getChannelId().toString().c_str());

	ctx->getService()->doReadTimeout(ctx);
}
Exemplo n.º 29
0
bool ConcreteDatabase::directExecute( const char* sql )
{
	if(!_asyncConn)
		return false;

	SqlConnection& conn = getAsyncConnection();
	SqlConnection::Lock guard(conn);
	return Retry::SqlOp<bool>(getLogger(),[sql](SqlConnection& c){ return c.execute(sql); })(conn,"SqlExec",[sql](){return sql;} );
}
LLVMModelDataSymbols::LLVMModelDataSymbols(const libsbml::Model *model,
        bool computeAndAssignConsevationLaws) :
        linearlyIndependentFloatingSpeciesSize(0),
        independentFloatingSpeciesSize(0),
        independentBoundarySpeciesSize(0),
        independentGlobalParameterSize(0),
        independentCompartmentSize(0)
{
    modelName = model->getName();

    // first go through the rules, see if they determine other stuff
    {
        const ListOfRules * rules = model->getListOfRules();
        for (unsigned i = 0; i < rules->size(); ++i)
        {
            const Rule *rule = rules->get(i);

            if (dynamic_cast<const AssignmentRule*>(rule))
            {
                assigmentRules.insert(rule->getVariable());
            }
            else if (dynamic_cast<const RateRule*>(rule))
            {
                uint rri = rateRules.size();
                rateRules[rule->getId()] = rri;
            }
            else if (dynamic_cast<const AlgebraicRule*>(rule))
            {
                poco_warning(getLogger(), string("encountered algegraic rule: ")
                        + rule->getId() + string(", currently not handled"));
            }
        }
    }

    // get the compartments, need to reorder them to set the independent ones
    // first
    initCompartments(model);


    // process the floating species
    initFloatingSpecies(model, computeAndAssignConsevationLaws);

    // display compartment info. We need to get the compartments before the
    // so we can get the species compartments. But the struct anal dumps
    // a bunch of stuff, so to keep things looking nice in the log, we
    // display the compartment info here.
    displayCompartmentInfo();

    initBoundarySpecies(model);

    initGlobalParameters(model);

    initReactions(model);

    initEvents(model);
}