示例#1
0
const std::string Tools::douane_root_path(void) const
{
  char    result[PATH_MAX];
  readlink("/proc/self/exe", result, PATH_MAX);
  const char * root_dirname = dirname(result);
  std::string root_path = std::string(root_dirname);

  LOG4CXX_DEBUG(logger, "Douane root path is " << root_path);

  // Remove the /bin in case the root_path ends with it.
  std::string substr = "/bin";
  size_t position = root_path.rfind(substr);
  if ((position != std::string::npos) && (position == (root_path.length() - substr.length())))
  {
    return root_path.substr(0, position);
  } else {
    return root_path;
  }
}
示例#2
0
bool SnapshotControl::SaveBloomFilter(BloomFilter<Checksum>* pbf, const string& bf_name)
{
    if (!FileSystemHelper::GetInstance()->IsDirectoryExists(vm_path_))
        FileSystemHelper::GetInstance()->CreateDirectory(vm_path_);
    if (FileSystemHelper::GetInstance()->IsFileExists(bf_name))
        FileSystemHelper::GetInstance()->RemoveFile(bf_name);

	FileHelper* fh = FileSystemHelper::GetInstance()->CreateFileHelper(bf_name, O_WRONLY);
	fh->Create();

	stringstream buffer;
	pbf->Serialize(buffer);
	LOG4CXX_DEBUG(logger_, "Bloom filter primary size " << buffer.str().size());
    fh->Write((char *)buffer.str().c_str(), buffer.str().size());

    fh->Close();
    FileSystemHelper::GetInstance()->DestroyFileHelper(fh);
    return true;
}
示例#3
0
文件: QueryPlan.cpp 项目: cerbo/scidb
const ArrayDesc& LogicalQueryPlanNode::inferTypes(std::shared_ptr< Query> query)
{
    std::vector<ArrayDesc> inputSchemas;
    ArrayDesc outputSchema;
    for (size_t i=0, end=_childNodes.size(); i<end; i++)
    {
        inputSchemas.push_back(_childNodes[i]->inferTypes(query));
    }
    outputSchema = _logicalOperator->inferSchema(inputSchemas, query);
    //FIXME: May be cover inferSchema method with another one and assign alias there?
    if (!_logicalOperator->getAliasName().empty())
    {
        outputSchema.addAlias(_logicalOperator->getAliasName());
    }
    _logicalOperator->setSchema(outputSchema);
    LOG4CXX_DEBUG(logger, "Inferred schema for operator " <<
                  _logicalOperator->getLogicalName() << ": " << outputSchema);
    return _logicalOperator->getSchema();
}
示例#4
0
void GameMaster::run()
{
    if(eh_->dh_->dhInitMysql() == false){
        LOG4CXX_ERROR(logger_,"system;Data handler failed to connect to db,exit!");
        exit(1);
    }
    
    eh_->dh_->loadTrialRank();
    eh_->dh_->loadPvpRankUids();

    vector<EventCmd> event_cmds;

    for(;;){
        long long now = time(NULL);
        eh_->now_time_ = now;

        if(eh_->dh_->db_error_ != 0){
            eh_->dh_->closeDbConnection();
            LOG4CXX_ERROR(logger_,"system;Data handler close connection to db!");
        }
        if(eh_->dh_->dbc_open_ == false){
            if(now - db_reconnect_time_ >= 60){
                if(eh_->dh_->dhInitMysql() == false){
                    LOG4CXX_ERROR(logger_,"system;Data handler failed to reconnect to db!");
                    db_reconnect_time_ = now;
                }
            }
        }
        event_cmds.clear();
        eq_->acquireLock();
        while(!(eq_->getEventQueue().empty())){
            event_cmds.push_back(eq_->getEventQueue().front());
            eq_->getEventQueue().pop();
        }
        eq_->releaseLock();
        for(size_t i=0;i<event_cmds.size();i++){
            LOG4CXX_DEBUG(logger_, "received;"<<event_cmds[i].cmd_);
            //nh_->sendString(event_cmds[i].fd_,event_cmds[i].cmd_);
            eh_->handle(event_cmds[i]);
        }
    }
}
void WSCoreBoundQueuesScheduler::pushToQueue(std::shared_ptr<Task> task) {
    int core = task->getPreferredCore();
    if (core >= 0 && core < static_cast<int>(this->_queues)) {
      // push task to queue that runs on given core
      this->_taskQueues[core]->push(task);
      LOG4CXX_DEBUG(this->_logger,  "Task " << std::hex << (void *)task.get() << std::dec << " pushed to queue " << core);
    } else if (core == Task::NO_PREFERRED_CORE || core >= static_cast<int>(this->_queues)) {
      if (core < Task::NO_PREFERRED_CORE || core >= static_cast<int>(this->_queues))
        // Tried to assign task to core which is not assigned to scheduler; assigned to other core, log warning
        LOG4CXX_WARN(this->_logger, "Tried to assign task " << std::hex << (void *)task.get() << std::dec << " to core " << std::to_string(core) << " which is not assigned to scheduler; assigned it to next available core");
      // push task to next queue
      {
        std::lock_guard<lock_t> lk2(this->_queuesMutex);
        this->_taskQueues[this->_nextQueue]->push(task);
        //std::cout << "Task " <<  task->vname() << "; hex " << std::hex << &task << std::dec << " pushed to queue " << this->_nextQueue << std::endl;
        //round robin on cores
        this->_nextQueue = (this->_nextQueue + 1) % this->_queues;
      }
    }
  }
示例#6
0
void Iax2Sessions::Hoover(time_t now)
{
	CStdString numSessions;
	int timeoutSeconds = 0;
	Iax2SessionRef session;
	std::map<CStdString, Iax2SessionRef>::iterator pair;
	std::list<Iax2SessionRef> toDismiss;
	std::list<Iax2SessionRef>::iterator it;

	numSessions = IntToString(m_bySrcIpAndCallNo.size());
	LOG4CXX_DEBUG(m_log, "Hoover - check " + numSessions + " sessions time:" + IntToString(now));
	timeoutSeconds = DLLCONFIG.m_rtpSessionWithSignallingTimeoutSec;

	for(pair=m_bySrcIpAndCallNo.begin(); pair!=m_bySrcIpAndCallNo.end(); pair++) {
		session = pair->second;

		if((now - session->m_lastUpdated) > timeoutSeconds)
			toDismiss.push_back(session);
	}

	for (it=toDismiss.begin(); it!=toDismiss.end(); it++) {
		session = *it;
		LOG4CXX_INFO(m_log,  "[" + session->m_trackingId + "] " + session->m_srcIpAndCallNo + " Expired");
		Stop(session);
	}

	/* Just in case? */
	toDismiss.clear();
	for(pair=m_byDestIpAndCallNo.begin(); pair!=m_byDestIpAndCallNo.end(); pair++) {
		session = pair->second;

		if((now - session->m_lastUpdated) > timeoutSeconds)
			toDismiss.push_back(session);
	}

	for (it=toDismiss.begin(); it!=toDismiss.end(); it++) {
                session = *it;
                LOG4CXX_INFO(m_log,  "[" + session->m_trackingId + "] " + session->m_destIpAndCallNo + " Expired");
                Stop(session);
        }
}
示例#7
0
bool retreiver::getdevices(RETREIVER_DATA *msg) {
	// db's connect is a blocking call so false means no more data
	// not a failure to connect, unless access/pswd is incorrect
	if(m_devices_db.get_devices() == false) // open db and get next record
		return false;

	if(m_devices_db.m_deviceid < 1) // invalid so skipping
		return true;

	if(checkhostname() == true) {
		msg->ip = m_devices_db.m_deviceip;
		msg->dnsname = m_devices_db.m_dnsname;
		msg->hostname = m_devices_db.m_hostname;

		msg->deviceid = m_devices_db.m_deviceid;
		LOG4CXX_DEBUG("got device record from db for " << msg->dnsname);
	} else {
		LOG4CXX_INFO("NOT PING-ABLE " << m_devices_db.m_dnsname);
	}
	return true;
}
示例#8
0
void ParticleContainerLC::emptyHaloSide(int fixedDim, int fixedVal) {
	int idx[DIM];
	idx[fixedDim] = fixedVal;
#if 1<DIM
	const int nextDim = (fixedDim+1) % DIM;
#endif
#if 3==DIM
	const int lastDim = (fixedDim+2) % DIM;
#endif
	// iterate over wall cells
#if 1<DIM
	for (idx[nextDim] = 0; idx[nextDim] < allCellNums[nextDim]; idx[nextDim]++)
#endif
#if 3==DIM
		for (idx[lastDim] = 0; idx[lastDim] < allCellNums[lastDim]; idx[lastDim]++)
#endif
		{
			allCells[calcIndex(idx, allCellNums)]->root = NULL;
		}
	LOG4CXX_DEBUG(particlelog, "end empty halo");
}
shared_ptr<IBDeviceResource> IBDeviceResourceManager::getResource(ibv_context* context)
{
	// TODO check if std::map allow concurrent read access
	tResourceMap::iterator it = mResourceMap.find(context);

	if(it == mResourceMap.end())
	{
		shared_ptr<IBDeviceResource> resource(new IBDeviceResource(context));

		if(mGlobalMemoryRegion.address != NULL && mGlobalMemoryRegion.size > 0)
			resource->regGlobalMemoryRegion(mGlobalMemoryRegion.address, mGlobalMemoryRegion.size);

		mResourceMap[context] = resource;

		LOG4CXX_DEBUG(mLogger, "creating IBDeviceResource which has ibv_context pointer = " << context);

		return resource;
	}

	return it->second;
}
示例#10
0
bool SnapshotControl::SaveSnapshotMeta()
{
    if (!FileSystemHelper::GetInstance()->IsDirectoryExists(vm_path_))
        FileSystemHelper::GetInstance()->CreateDirectory(vm_path_);
    if (FileSystemHelper::GetInstance()->IsFileExists(ss_meta_pathname_)) {
        LOG4CXX_WARN(logger_, "Sanpshot metadata exists, will re-create " << ss_meta_pathname_);
        FileSystemHelper::GetInstance()->RemoveFile(ss_meta_pathname_);
    }
	FileHelper* fh = FileSystemHelper::GetInstance()->CreateFileHelper(ss_meta_pathname_, O_WRONLY);
	fh->Create();

	stringstream buffer;
	ss_meta_.Serialize(buffer);
    ss_meta_.SerializeRecipe(buffer);
	LOG4CXX_DEBUG(logger_, "save snapshot meta, size is" << buffer.str().size());
    fh->Write((char *)buffer.str().c_str(), buffer.str().size());

    fh->Close();
    FileSystemHelper::GetInstance()->DestroyFileHelper(fh);
    return true;
}
示例#11
0
文件: SDL.cpp 项目: bossie/Assteroids
shared_ptr<SDL_Surface> SDL::generate(const string & filename, bool alpha) {
    shared_ptr<SDL_Surface> image(IMG_Load(filename.c_str()), &freeSurface);

    if (image == NULL)
        throw SDLException(IMG_GetError(), HERE);

    shared_ptr<SDL_Surface> optimizedImage(optimize(image, alpha));

    if (optimizedImage == NULL)
        throw SDLException(IMG_GetError(), HERE);

    Uint32 flags = SDL_RLEACCEL;
    if (alpha)
        flags |= SDL_SRCALPHA;

    SDL_SetAlpha(optimizedImage.get(), flags, SDL_ALPHA_OPAQUE); // doubles the fps :o

    LOG4CXX_DEBUG(m_logger, "Image at " << filename << " loaded successfully. Alpha blending is " << (alpha ? "enabled." : "disabled."));

    return optimizedImage;
}
示例#12
0
bool FileCertManager::isCertKnown(std::string dn, std::string fingerprint)
{
	LOG4CXX_TRACE(logger, "isCertKnown()");
	LOG4CXX_DEBUG(logger, "dn = " << dn);
	LOG4CXX_DEBUG(logger, "fp = " << fingerprint);

	const map<string,string>::iterator it = certMap.find(dn);
	if (it == certMap.end()) {
		LOG4CXX_DEBUG(logger, "DN not registered");
	} else {
		LOG4CXX_DEBUG(logger, "Comparing fingerprints...");
		LOG4CXX_DEBUG(logger, "fingerprint [file]  = " << (*it).second);
		LOG4CXX_DEBUG(logger, "fingerprint [asked] = " << fingerprint);

		if (!(*it).second.compare(fingerprint)) {
			LOG4CXX_DEBUG(logger, "Good fingerprint for this dn :-)");
			return true;
		} else {
			LOG4CXX_DEBUG(logger, "Wrong fingerprint for this dn :-(");
		}
	}
	return false;
}
示例#13
0
// ============================================================
// Function : throwError()
// ------------------------------------------------------------
// 
// ============================================================
void errorHandler::throwError(error e)
{
    this->messages.push_back(e);
    if (this->maxMessages != 0 && (this->messages.size() > this->maxMessages)) {
      this->messages.pop_front();
    }

    if (this->log && (e.getType() <= this->level)) {
#ifdef USE_LOG4CXX
      // Get logger object
      log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger(LOGGER_NAME));

      std::stringstream ss;
      ss << e;
      switch(e.getType()) {
        case 0:
          LOG4CXX_INFO(logger, ss.str());
          break;
        case 1:
          LOG4CXX_INFO(logger, ss.str());
          break;
        case 2:
          LOG4CXX_WARN(logger, ss.str());
          break;
        case 3:
          LOG4CXX_DEBUG(logger, ss.str());
          break;
        case 4:
          LOG4CXX_ERROR(logger, ss.str());
          break;
        default:
          LOG4CXX_INFO(logger, ss.str());
          break;
      }
#else
      *stream << e;
      stream->flush();
#endif
    }
}
long MessageHandler::insertAudio(long translationid, const MessageAudio &ma)
{
    LOG4CXX_INFO(narratorMsgHlrLog, "Inserting new messageaudio for translation with id: " << translationid);
    LOG4CXX_DEBUG(narratorMsgHlrLog, "tagid: " << ma.getTagid() << ", uri: " << ma.getUri() << ", md5: " << ma.getMd5() << ", size: " << ma.getSize() << ", length: " << ma.getLength() << ", encoding: " << ma.getEncoding());

    int audioid = -1;

    if(ma.isAudioDataNil()) {
        LOG4CXX_ERROR(narratorMsgHlrLog, "No audio data has been set");
        return -1;
    }

    if(!db->prepare("INSERT INTO messageaudio (translation_id, tagid, text, length, encoding, data, size, md5) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")) {
        LOG4CXX_ERROR(narratorMsgHlrLog, "Query failed '" << db->getLasterror() << "'");
        return -1;
    }

    if(!db->bind(1, translationid) ||
            !db->bind(2, ma.getTagid()) ||
            !db->bind(3, ma.getText().c_str()) ||
            !db->bind(4, ma.getLength()) ||
            !db->bind(5, ma.getEncoding().c_str()) ||
            !db->bind(6, ma.getAudioData(), ma.getSize()) ||
            !db->bind(7, (long)ma.getSize()) ||
            !db->bind(8, ma.getMd5(), 32, NULL)) {
        LOG4CXX_ERROR(narratorMsgHlrLog, "Bind failed '" << db->getLasterror() << "'");
        return -1;
    }

    narrator::DBResult result;
    if(!db->perform(&result)) {
        LOG4CXX_ERROR(narratorMsgHlrLog, "Query failed '" << db->getLasterror() << "'");
        return -1;
    }

    audioid = result.getInsertId();

    return audioid;
}
示例#15
0
void MPIPhysical::postSingleExecute(shared_ptr<Query> query)
{
    // On a non-participating launcher instance it is difficult
    // to determine when the launch is complete without a sync point.
    // postSingleExecute() is run after all instances report success of their execute() phase,
    // that is effectively a sync point.
    assert(query->getCoordinatorID() == COORDINATOR_INSTANCE);
    assert(_mustLaunch);
    assert(_ctx);
    const uint64_t lastIdInUse = _ctx->getLastLaunchIdInUse();

    boost::shared_ptr<MpiLauncher> launcher(_ctx->getLauncher(lastIdInUse));
    assert(launcher);
    if (launcher && launcher == _launcher) {
        LOG4CXX_DEBUG(logger, "MPIPhysical::postSingleExecute: destroying last launcher for launch = " << lastIdInUse);
        assert(lastIdInUse == _launchId);

        launcher->destroy();
        _launcher.reset();
    }
    _ctx.reset();
}
示例#16
0
void client_socket_utils::read_data_callback(const boost::system::error_code& e, socket_session_ptr session, message& msg)
{
	LOG4CXX_DEBUG(firebird_log, "command =[" << msg.command << "],[" << msg.business_type << "],[" << msg.data() << "]");

	if (msg.command == heartbeat)
	{ //心跳
	}
	else
		if (msg.command == regist)
		{ //注册
			LOG4CXX_FATAL(firebird_log, "服务器:[" << session->get_business_type() << "]注册成功。");
		}
		else
			if (msg.command == normal)
			{ //业务数据
				handle_read_data(msg, session);
			}
			else
			{
				LOG4CXX_ERROR(firebird_log, KDS_CODE_INFO << "收到非法消息包!");
			}
}
示例#17
0
bool TryIax2MiniVoiceFrame(EthernetHeaderStruct* ethernetHeader, IpHeaderStruct* ipHeader,
                UdpHeaderStruct* udpHeader, u_char* udpPayload)
{
	struct Iax2MiniHeader *mini = (struct Iax2MiniHeader *)udpPayload;
        int data_len = 0, udp_act_payload_len = 0;
	Iax2PacketInfoRef info(new Iax2PacketInfo());

        if(!DLLCONFIG.m_iax2Support)
                return false;

        udp_act_payload_len = (ntohs(udpHeader->len)-sizeof(UdpHeaderStruct));
        if(udp_act_payload_len < (int)sizeof(*mini))
                return false; /* Frame too small */

        if((ntohs(mini->scallno) & 0x8000))
                return false; /* Not a Mini frame */

	data_len = ((u_char*)ipHeader+ntohs(ipHeader->ip_len))-(udpPayload+sizeof(*mini));
        if(data_len == 0)
                return false; /* Empty packet? */

        info->m_sourceIp = ipHeader->ip_src;
        info->m_destIp = ipHeader->ip_dest;
        info->m_sourcecallno = (ntohs(mini->scallno) & ~0x8000);
        info->m_destcallno = 0;
        info->m_payloadSize = data_len;
        info->m_payload = udpPayload+sizeof(*mini);
        info->m_payloadType = 0;
	info->m_timestamp = ntohs(mini->ts);
        info->m_arrivalTimestamp = time(NULL);
        info->m_frame_type = IAX2_FRAME_MINI;

	CStdString logMsg, packetInfo;
	info->ToString(packetInfo);
	logMsg.Format("IAX2 mini frame: %s", packetInfo);
	LOG4CXX_DEBUG(s_iax2parsersLog, logMsg);

        return Iax2SessionsSingleton::instance()->ReportIax2Packet(info);
}
void DefaultObjectFactory::registerPrototype(const Serializable *prototype)
{
    // Given a C++ class names list, replace the namespace separator "::" with a dot "." (Java style).
    // For instance "varieties::GrannySmith,plants::fruits::Apple" becomes "varieties.GrannySmith,plants.fruits.Apple".
    std::string hierarchy = boost::regex_replace(prototype->getClassHierarchy(), boost::regex("::"), ".");
    if (hierarchy.size() == 0)
    {
        throw aqlib::Exception("Invalid class hierarchy");
    }
    
    LOG4CXX_DEBUG(logger, mInstanceName << " registerPrototype " << hierarchy);
    
    StringTokenizer tokenizer(hierarchy, ",");
    while (tokenizer.hasMoreTokens())
    {
        const std::string type = tokenizer.nextToken();
        if (type.size() > 0)
        {
            mPrototypes[type] = prototype;
        }
    }
}
示例#19
0
//-------------------------------------------------------------------------------------
void DebugHelper::debug_msg(const char * str, ...)
{
    if(str == NULL)
        return;

    KBEngine::thread::ThreadGuard tg(&this->logMutex);

#ifdef NO_USE_LOG4CXX
#else
    va_list ap;
    va_start(ap, str);
#if KBE_PLATFORM == PLATFORM_WIN32
    uint32 size = _vsnprintf(_g_buf, DBG_PT_SIZE, str, ap);
#else
    uint32 size = vsnprintf(_g_buf, DBG_PT_SIZE, str, ap);
#endif
    va_end(ap);
    LOG4CXX_DEBUG(g_logger, _g_buf);
#endif

    onMessage(LOG_DEBUG, _g_buf, size);
}
示例#20
0
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *                                                                           *
 *        * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *        *
 *                                                                           *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
EapTncFragment Fragmentation::getNextFragment(TNC_ConnectionID conID) throw (std::logic_error)
{
	LOG4CXX_DEBUG(logger, "have " << this->allEapTncFragments[conID].size() << " fragments of ConnectionID " << conID );

	if (this->allEapTncFragments[conID].empty()) {
		/* ERROR */
		/* delete queue */
		this->allEapTncFragments.erase(conID);
		throw std::logic_error(std::string("getNextFragment(TNC_ConnectionID): called but fragmentation not already in progress. Cancelling fragmentation for") + conID);
	}
	
	/* get the next fragment */
	EapTncFragment * tmp = this->allEapTncFragments[conID].front();
	this->allEapTncFragments[conID].pop();
	
	/* if no more fragments in queue then remove queue */
	if (this->allEapTncFragments[conID].empty())
		this->allEapTncFragments.erase(conID);
	
	EapTncFragment ret = *tmp;
	delete tmp;
	return ret;
}
示例#21
0
			boost::tuple<bool, findik::filter::filter_reason_ptr> 
					domain_filter::filter(findik::io::connection_ptr connection_, unsigned int param) 
			{
				LOG4CXX_DEBUG(debug_logger_, "Domain name filter entered"); // log for filter entrance
				
				// get request object from current data
				request_ptr req = boost::static_pointer_cast<request>(connection_->current_data());
				
				// check whether hostname exists in domain blacklist
				if(!FI_SERVICES->db_srv().domainQuery(req->request_host(), param)){
					boost::shared_ptr<http_filter_result_generator> reply_(
						new http_filter_result_generator(
							filter_code_, false, 
							response::forbidden, true, 
							"Domain blocked : " + req->request_host(), 
							req->request_host(), connection_, req
						));	
					return boost::make_tuple(false, findik::filter::filter_reason::create_reason(reply_->reply_str(), reply_->log_str()));	
				} 

				findik::filter::filter_reason_ptr frp_;
				return boost::make_tuple(true, frp_);	
			}
示例#22
0
			boost::tuple<bool, findik::filter::filter_reason_ptr> 
					http_connect_filter::filter(findik::io::connection_ptr connection_, unsigned int param) 
			{
				LOG4CXX_DEBUG(debug_logger_, "HTTP Connect filter entered"); // log for filter entrance
				
				// get request object from current data
				request_ptr req = boost::static_pointer_cast<request>(connection_->current_data());

				// check whether method is connect
				if(req->method == request::connect){
					boost::shared_ptr<http_filter_result_generator> reply_(
						new http_filter_result_generator(
							filter_code_, false, 
							response::forbidden, true, 
							"HTTP Connet request denied.", 
							req->request_host(), connection_, req
						));	
					return boost::make_tuple(false, findik::filter::filter_reason::create_reason(reply_->reply_str(), reply_->log_str()));	
				} 

				findik::filter::filter_reason_ptr frp_;
                                return boost::make_tuple(true, frp_);
			}
示例#23
0
void DirectionSelector::ProcessAreaCodesMap(char *line, int ln)
{
	char *areaCode = NULL;
	char *side = NULL;
	CStdString logMsg;

	areaCode = line;
	side = strchr(line, ':');

	if(!side || !areaCode)
	{

		logMsg.Format("ProcessAreaCodesMap: invalid format of line:%d in the area codes maps file", ln);
		LOG4CXX_WARN(LOG.directionSelectorLog, logMsg);
		return;
	}

	*(side++) = '\0';

	CStdString code, sideKept;
	code = areaCode;
	sideKept = side;

	code.Trim();
	sideKept.Trim();

	if((!StringIsPhoneNumber(code)) || (CaptureEvent::AudioKeepDirectionEnum)CaptureEvent::AudioKeepDirectionToEnum(sideKept) == CaptureEvent::AudioKeepDirectionInvalid)
	{
		logMsg.Format("ProcessAreaCodesMap: invalid format of line:%d in the area codes maps file", ln);
		LOG4CXX_WARN(LOG.directionSelectorLog, logMsg);
		return;
	}

	m_areaCodesMap.insert(std::make_pair(code, side));
	LOG4CXX_DEBUG(LOG.directionSelectorLog,  "AreaCodesMap codes:" + code + " side:" + sideKept);
}
示例#24
0
void SYSTEM::sysmgr_ipc_modstart(WEvent& event)
{
    if (PTL_SYSMGR != event.PtlId)
    {
        return;
    }

    RealModuleId  * rmid;
    rmid = (RealModuleId *)&event.bcEvent.src;

    char tmpbuf[512] = {0};

    switch (rmid->lmi)
    {

    case LMI_SPP:
        sprintf(tmpbuf, "[Node=0x%02X] [Ac=0x%02X]  SPP started.",rmid->ni, rmid->ac);
        break;

    case LMI_TCPAGN:
        sprintf(tmpbuf, "[Node=0x%02X] [Ac=0x%02X]  TCPAGN started.",rmid->ni, rmid->ac);
        break;

    case LMI_SCP:
        sprintf(tmpbuf, "[Node=0x%02X] [Ac=0x%02X]  SCP started.",rmid->ni, rmid->ac);
        break;

    case LMI_CIF:
        sprintf(tmpbuf, "[Node=0x%02X] [Ac=0x%02X]  IFAGENT started.",rmid->ni, rmid->ac);
        break;

    default: // Exception handle.
        break;
    }
    LOG4CXX_DEBUG(rootlog, tmpbuf);
}
示例#25
0
void DealPlatEvent::handle(Event* e)
{
	int64 nUserID = e->uid();
	int nPlatSrvID = e->platsrvid();

	if(e->cmd() == EVENT_ADMIN_RELOAD)
	{
		processReloadConfig(e);
		return;
	}

	LOG4CXX_DEBUG(logger_,"get msg,type:"<<e->cmd()<<",userID:"<<nUserID);

	switch(e->cmd())
	{
	case EVENT_USER_LOGIN:
		{
			HandleUserLogin(e);
		}
		break;
	default:
		break;
	}
}
void CTcapTrans::handleMapSendRouteInfo(TcapCompParseResult* pTrans)
{
    // @zh TODO 考虑呼转的情况
    if(pTrans->stMapParseRslt.stSendRouteInfoRslt.msisdnLen <= 0)
    {
    	LOG4CXX_DEBUG(rootlog, __FILE__<<"::"<<__LINE__<<": Invalid MSISDN, length is 0!");
        return;
    }
    //@zh TODO
    static size_t cclen = 2;//86
    static char *szCC= "86";
    //@zh

    if(pTrans->stMapParseRslt.stSendRouteInfoRslt.InterrogationType == 0) //basic call
    {
        //去掉国家码86
        if(pTrans->ucRspCode > 0) // @zh 非成功呼叫(判断被叫是否为本网用户)
        {}
        //
        else
        {
            unsigned char* pNum = pTrans->stMapParseRslt.stSendRouteInfoRslt.szMSISDN;
            unsigned char numLen = pTrans->stMapParseRslt.stSendRouteInfoRslt.msisdnLen;
            if(memcmp(pNum, szCC, cclen) == 0)
            {
                pNum += cclen;
                numLen -= cclen;
            }
            sysPtr->updateIMSI2MSISDN(pTrans->stMapParseRslt.stSendRouteInfoRslt.szIMSI, pNum);
        }
    }
    else//???
    {
        //MSISDN号码为前一次SendRoutInfo的呼转号码
    }
}
示例#27
0
Chunk* PanguAppendStore::LoadAppendChunk()
{
    if (mCurrentAppendChunk.get() != 0)
    {
        if (mCurrentAppendChunk->IsChunkFull() == false)
        {
            //LOG4CXX_DEBUG(logger_, "Loaded Current chunk");
            return mCurrentAppendChunk.get();
        }
        else
        {
            /* Close previous chunk and allocate new chunk */
            Chunk* p_chunk = mCurrentAppendChunk.get();
            TurnOnWrite(p_chunk);
            p_chunk->Close();
	        LOG4CXX_DEBUG(logger_, "Allocating next chunk, because current chunk is Full");	
            AllocNextChunk();
        }
    }
    try
    {
        mCurrentAppendChunk.reset(new Chunk(mRoot, mAppendChunkId, mMeta.maxChunkSize, true, mCodec, mCache, mMeta.blockIndexInterval));
    }
    catch (...)
    {
        LOG4CXX_ERROR(logger_, "[AppendStore] chunk is disabled for append, chunk id : " << mAppendChunkId);
        throw;
    }

    if (0 == mCurrentAppendChunk.get())
    {
        THROW_EXCEPTION(AppendStoreWriteException, "Cannot get valid chunk for append");
    }
    LOG4CXX_TRACE(logger_, "Store::LoadedAppendChunk" ); 
    return mCurrentAppendChunk.get();
}
// Update values for a messageparameter
long MessageHandler::updateParameter_with_id(long parameterid, const MessageParameter &mp)
{
    LOG4CXX_INFO(narratorMsgHlrLog, "Updating messageparameter with id: " << parameterid);
    LOG4CXX_DEBUG(narratorMsgHlrLog, "key: " << mp.getKey() << ", type: " << mp.getTypeStr());

    if(!db->prepare("UPDATE messageparameter SET key=?, type=? WHERE rowid=?")) {
        LOG4CXX_ERROR(narratorMsgHlrLog, "Query failed '" << db->getLasterror() << "'");
        return -1;
    }

    if(!db->bind(1, mp.getKey().c_str()) ||
            !db->bind(2, mp.getTypeStr().c_str()) ||
            !db->bind(3, parameterid)) {
        LOG4CXX_ERROR(narratorMsgHlrLog, "Bind failed '" << db->getLasterror() << "'");
        return -1;
    }

    if(!db->perform()) {
        LOG4CXX_ERROR(narratorMsgHlrLog, "Query failed '" << db->getLasterror() << "'");
        return -1;
    }

    return parameterid;
}
// Update values for a message
long MessageHandler::updateMessage_with_id(long messageid, const Message &msg)
{
    LOG4CXX_INFO(narratorMsgHlrLog, "Updating message with id: " << messageid);
    LOG4CXX_DEBUG(narratorMsgHlrLog, "string: " << msg.getString() << ", class: " << msg.getClass());

    if(!db->prepare( "UPDATE message SET string=?, class=?, WHERE rowid=?")) {
        LOG4CXX_ERROR(narratorMsgHlrLog, "Query failed '" << db->getLasterror() << "'");
        return -1;
    }

    if(!db->bind(1, msg.getString().c_str()) ||
            !db->bind(2, msg.getClass().c_str()) ||
            !db->bind(3, messageid)) {
        LOG4CXX_ERROR(narratorMsgHlrLog, "Bind failed '" << db->getLasterror() << "'");
        return -1;
    }

    if(!db->perform()) {
        LOG4CXX_ERROR(narratorMsgHlrLog, "Query failed '" << db->getLasterror() << "'");
        return -1;
    }

    return messageid;
}
示例#30
0
void setOutputMatrixToAlgebraDefault(float_tt* dst, size_t numVal, log4cxx::LoggerPtr logger) {
    Timing timer;
    valsSet(dst, ::nan(""), numVal); // ScaLAPACK algorithm should provide all entries in matrix
    LOG4CXX_DEBUG(SCALAPACKPHYSICAL_HPP_logger, "setOutputMatrixToAlgebraDefault took " << timer.stop());
}