[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xmlblaster] modify in ConnectionsHandler.cpp



Hello

	I found there has some bug in connectionshandler.cpp like this: 
you are maybe forget to add SubscribeQueueEntry and UnSubscribeQueueEntry
to ClientQueueProperty, and result in some bugs when program runs in failsafe model.
    It runs correctly after I had made some changes.

1. in subscribe() method
   try {
      SubscribeReturnQos ret = connection_->subscribe(key, qos);
      //add by pky to add subscribe entries to client ram queue
      if (!queue_) {
	      if (!connectQos_) {
	         throw XmlBlasterException(INTERNAL_SUBSCRIBE, ME + "::queuesubscribe", 
             "need to create a queue but the connectQos is NULL (probably never connected)");
	      }
	      if (log_.trace()) log_.trace(ME+":queueSubscribe", "creating a client queue ...");
	      queue_ = &QueueFactory::getFactory().getPlugin(global_, connectQos_->getClientQueueProperty());
	      log_.info(ME+":queuesubscribe", "created a client queue");
	   }
	   if (log_.trace()) 
	      log_.trace(ME, string("queuesubscribe: entry has been queued"));
	   SubscribeQueueEntry entry(global_, key, qos);
	   queue_->put(entry);
       //end
       return ret;
   }   
   catch (XmlBlasterException& ex) {
      if ( ex.isCommunication() ) toPollingOrDead(&ex);
      throw ex;
   }

2. in unsubscribe() method
   try {
      vector<UnSubscribeReturnQos> ret = connection_->unSubscribe(key, qos);
	  //add by pky to add unsubscribe entries to client ram queue
      if (!queue_) {
	      if (!connectQos_) {
	         throw XmlBlasterException(INTERNAL_UNSUBSCRIBE, ME + "::queueunsubscribe", 
             "need to create a queue but the connectQos is NULL (probably never connected)");
	      }
	      if (log_.trace()) log_.trace(ME+":queueunsubscribe", "creating a client queue ...");
	      queue_ = &QueueFactory::getFactory().getPlugin(global_, connectQos_->getClientQueueProperty());
	      log_.info(ME+":queueunsubscribe", "created a client queue");
	   }
	   if (log_.trace()) 
	      log_.trace(ME, string("queueunsubscribe: entry has been queued"));
       UnSubscribeQueueEntry entry(global_, key, qos);
	   queue_->put(entry);
       //end
       return ret;
   }   
   catch (XmlBlasterException& ex) {
      if ( ex.isCommunication() ) toPollingOrDead(&ex);
      throw ex;
   }

  By the way, does anyone has a look at ptp model in cplusplus client side.

thanks any way        
 				

			   pikaiyuan
			   2004-07-01