Exemplo n.º 1
0
//--------------------------------------------------------------------------------
void RemovePipe::handle(const ObjectSeq& seq) {

  MCE_INFO("RemovePipe::handle --> thread_id = " << pthread_self() << " seq size:" << seq.size());

  if (seq.empty()) {
    return;
  } 
  std::set<std::string> removeKeySet; 
  std::size_t si = seq.size();

  int j = 0;
  timeval beg, end;
  gettimeofday(&beg, NULL);

  for (size_t i = 0; i < seq.size(); ++i) {

    RemoveFeedFromDBKeyPtr st = RemoveFeedFromDBKeyPtr::dynamicCast(seq.at(i));
    if (st->indexSeq.empty()) {
      continue;
    }
    gettimeofday(&end, NULL);
    float timeuse=1000000*(end.tv_sec-beg.tv_sec)+end.tv_usec-beg.tv_usec;
    timeuse/=1000;
    MCE_INFO("RemovePipe::handle --> execute task. source:" << st->indexSeq[0]->source << " type:" << st->indexSeq[0]->stype << " i:" << i << " seq_size:" << si  << " time:" << timeuse); 
    TaskManager::instance().execute(new RemoveFeedTask(st->indexSeq));
    gettimeofday(&beg, NULL);
    struct timeval tv = { 0, 100 * 1000 };
    select(0, NULL, NULL, NULL, &tv);
  }
  MCE_INFO("RemovePipe::handle --> loop end. last dup:" << j);
}
Exemplo n.º 2
0
//--------------------------------------------------------------------------------
void VertifyPipe::handle(const ObjectSeq& seq) {

	//MCE_INFO("VertifyPipe::handle --> thread_id = " << pthread_self());
	if (seq.empty()) {
		return;
	} else {
		//MCE_DEBUG("VertifyPipe::handle --> objectseq size = " <<seq.size());
	}
	
	VerifySeq vSeq;
	IntSeq needNotVerifyUsers;
	for (size_t i = 0; i < seq.size(); ++i) {
		MessagePtr m = MessagePtr::dynamicCast(seq.at(i));
		//MCE_INFO("m->from = " << m->from->userId << " m->to = " << m->to->userId);
		if( (m->type != MESSAGE && m->type != OFFLINE_MESSAGE) || (m->from->userId == 365734329 || m->to->userId == 365734329) ){//客服ID,不检查好友。
			//MCE_INFO("VertifyPipe::handle --> m->from = " << m->from << " m->to = " << m->to);
			needNotVerifyUsers.push_back(i);
			continue;
		}
		VerifyPtr v = new Verify();
		v->from = m->from->userId;
		v->to = m->to->userId;
		/*if(MESSAGE != m->type){
			v->to = v->from;
		}*/
		v->type = m->type;

/*		if (v->type == SYSTEM_MESSAGE) {
			v->sysMsgType = m->from->endpoint;
		}*/
		v->index = i;

		vSeq.push_back(v);
	}
	MyUtil::IntSeq indexSeq;
	try{
	 indexSeq = TalkRightAdapter::instance().batchVerify(getIndex(), vSeq);
	}catch(Ice::Exception& e){
		MCE_WARN("VertifyPipe::handle-->TalkRightAdapter::batchVerify-->" << e);
		}
	indexSeq.insert(indexSeq.end(), needNotVerifyUsers.begin(), needNotVerifyUsers.end());

	//MCE_DEBUG("VertifyPipe::handle -->indexSeq size:"<<indexSeq.size());
	for (size_t i = 0; i < indexSeq.size(); ++i) {
		MessagePtr m = MessagePtr::dynamicCast(seq.at(indexSeq.at(i)));
		//MCE_DEBUG("VertifyPipe::handle --> "<<m->to->index);
		if (m->to->index == 0 || m->to->index == 2 || m->to->index >1) {
			//MCE_DEBUG("VertifyPipe::handle --> endpoint:"<<m->to->endpoint);
			PipePool::instance().push(m->to->endpoint, 0, m);
		}
	}

}
Exemplo n.º 3
0
//--------------------------------------------------------------------------------
void PostPipe::handle(const ObjectSeq& seq) {

	if (seq.empty()) {
		return;
	}
	MessageSeq mseq;
	for (size_t i = 0; i < seq.size(); ++i) {
		mseq.push_back(MessagePtr::dynamicCast(seq.at(i)));
	}
	try {
		MucDeliverManagerI::instance().getProxyServerOneway(mseq.at(0)->to)->deliver(mseq);
	} catch(Ice::Exception& e) {
		MCE_WARN("PostPipe::handle --> deliver err:"<<e<<"  to endpoint:"<< mseq.at(0)->to);
	}
	MCE_DEBUG(__FUNCTION__ << " --> deliver size="<<mseq.size());
}
Exemplo n.º 4
0
void PostPipe::handle(const ObjectSeq& seq) {
	//MCE_INFO("PostPipe::handle --> thread_id = " << pthread_self());
	if (seq.empty()) {
		return;
	} else {
		//MCE_DEBUG("PostPipe::handle --> objectseq size = " <<seq.size());
	}
	//MCE_DEBUG("PostPipe::handle --> size:" << seq.size());
	MessageSeq mseq;
	for (size_t i = 0; i < seq.size(); ++i) {
		mseq.push_back(MessagePtr::dynamicCast(seq.at(i)));
	}
	try {
		if((mseq.at(0)->to->endpoint[0] == 'T') || (mseq.at(0)->to->endpoint[0] == 'W') || (mseq.at(0)->to->endpoint[0] == 'P')){
			DeliverManagerI::instance().getProxyServerOneway(mseq.at(0)->to)->deliver(mseq);
		}
	} catch(Ice::Exception& e) {
		MCE_WARN("PostPipe::handle -->ProxyAdapter::delivere-->"<<e<<"  to endpoint:"<< mseq.at(0)->to);
	}
}
Exemplo n.º 5
0
void PostPipe::handle(const ObjectSeq& seq) {

	if (seq.empty()) {
		return;
	} else {
		MCE_DEBUG("PostPipe::handle --> objectseq size = " <<seq.size());
	}

	MessageSeq mseq;
	for (size_t i = 0; i < seq.size(); ++i) {
		mseq.push_back(MessagePtr::dynamicCast(seq.at(i)));
	}
	try {
		MCE_DEBUG("start to deliver --> toid:"<<mseq.at(0)->to->userId);
		WTalkProxyManagerI::instance().getAccessServerOneway(getName())->deliver(mseq);
		MCE_DEBUG("end  deliver --> toid:"<<mseq.at(0)->to->userId);
	} catch(Ice::Exception& e) {
		MCE_WARN("PostPipe::handle --> deliver err:"<<e<<"  to endpoint:"<< mseq.at(0)->to);
	}
}