util: replace EventEmitter with Signal in NotificationSubscriber
refs #2350
Breaks: nfd:commit:04cf5a99d93d8f64571753260e71ade90332f860
Breaks: nlsr:commit:c2e51f6b6b85a602275dd59bfaaa0fa0403e0978
Change-Id: I54e9b8b8f8d172826616b33e8363cd27a1c53917
diff --git a/tests/unit-tests/util/notification-subscriber.cpp b/tests/unit-tests/util/notification-subscriber.cpp
index 96f5bf4..643daf0 100644
--- a/tests/unit-tests/util/notification-subscriber.cpp
+++ b/tests/unit-tests/util/notification-subscriber.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2015 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -97,12 +97,6 @@
}
void
- clearNotificationHandlers()
- {
- subscriber.onNotification.clear();
- }
-
- void
afterTimeout()
{
hasTimeout = true;
@@ -155,6 +149,7 @@
util::NotificationStream<SimpleNotification> notificationStream;
shared_ptr<DummyClientFace> subscriberFace;
util::NotificationSubscriber<SimpleNotification> subscriber;
+ util::signal::Connection notificationConn;
uint64_t lastDeliveredSeqNo;
@@ -171,9 +166,10 @@
subscriber.start();
BOOST_REQUIRE_EQUAL(subscriber.isRunning(), false);
- subscriber.onNotification += bind(&EndToEndFixture::afterNotification, this, _1);
- subscriber.onTimeout += bind(&EndToEndFixture::afterTimeout, this);
- subscriber.onDecodeError += bind(&EndToEndFixture::afterDecodeError, this, _1);
+ notificationConn = subscriber.onNotification.connect(
+ bind(&EndToEndFixture::afterNotification, this, _1));
+ subscriber.onTimeout.connect(bind(&EndToEndFixture::afterTimeout, this));
+ subscriber.onDecodeError.connect(bind(&EndToEndFixture::afterDecodeError, this, _1));
// not received when subscriber is not running
this->deliverNotification("n1");
@@ -231,7 +227,7 @@
BOOST_CHECK(this->hasInitialRequest());
// stop if handlers are cleared
- subscriber.onNotification += bind(&EndToEndFixture::clearNotificationHandlers, this);
+ notificationConn.disconnect();
subscriberFace->sentInterests.clear();
this->deliverNotification("n5");
advanceClocks(time::milliseconds(1));