summaryrefslogtreecommitdiff
path: root/cpp/src/IceStorm/Subscriber.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2008-03-07 15:42:08 +0800
committerMatthew Newhook <matthew@zeroc.com>2008-03-07 15:42:08 +0800
commitdac2e6d08bc6ebf899c95155c9b958061c307105 (patch)
tree7fea0b0387e607fff18a09d553e3c5aa6de2668d /cpp/src/IceStorm/Subscriber.cpp
parentCall flush directly, don't use the timer thread. (diff)
downloadice-dac2e6d08bc6ebf899c95155c9b958061c307105.tar.bz2
ice-dac2e6d08bc6ebf899c95155c9b958061c307105.tar.xz
ice-dac2e6d08bc6ebf899c95155c9b958061c307105.zip
fix assertion. Remove some junk code.
Diffstat (limited to 'cpp/src/IceStorm/Subscriber.cpp')
-rw-r--r--cpp/src/IceStorm/Subscriber.cpp45
1 files changed, 21 insertions, 24 deletions
diff --git a/cpp/src/IceStorm/Subscriber.cpp b/cpp/src/IceStorm/Subscriber.cpp
index 8dcdbd9f64c..f5e40eb76a6 100644
--- a/cpp/src/IceStorm/Subscriber.cpp
+++ b/cpp/src/IceStorm/Subscriber.cpp
@@ -149,25 +149,6 @@ private:
const TopicLinkPrx _obj;
};
-class ResponseTimerTask : public IceUtil::TimerTask
-{
-public:
- ResponseTimerTask(const SubscriberPtr& subscriber) :
- _subscriber(subscriber)
- {
- }
-
- virtual void
- runTimerTask()
- {
- _subscriber->flush();
- }
-
-private:
-
- const SubscriberPtr _subscriber;
-};
-
class OnewayIceInvokeI : public Ice::AMI_Object_ice_invoke, public Ice::AMISentCallback
{
public:
@@ -309,14 +290,30 @@ SubscriberBatch::doFlush()
{
_lock.notify();
}
+
+ //
+ // If the subscriber isn't online we're done.
+ //
+ if(_state != SubscriberStateOnline)
+ {
+ return;
+ }
v.swap(_events);
assert(!v.empty());
}
- vector<Ice::Byte> dummy;
- for(EventDataSeq::const_iterator p = v.begin(); p != v.end(); ++p)
+ try
{
- _obj->ice_invoke((*p)->op, (*p)->mode, (*p)->data, dummy, (*p)->context);
+ vector<Ice::Byte> dummy;
+ for(EventDataSeq::const_iterator p = v.begin(); p != v.end(); ++p)
+ {
+ _obj->ice_invoke((*p)->op, (*p)->mode, (*p)->data, dummy, (*p)->context);
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ error(false, ex);
+ return;
}
_obj->ice_flushBatchRequests_async(new FlushBatchI(this));
@@ -398,7 +395,7 @@ SubscriberOneway::sent()
{
_lock.notify();
}
- else if(_outstanding < _maxOutstanding && !_events.empty())
+ else if(_outstanding <= 0 && !_events.empty())
{
flush();
}
@@ -420,7 +417,7 @@ void
SubscriberTwoway::flush()
{
IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(_lock);
-
+
//
// If the subscriber isn't online we're done.
//