utils: Removing concept of periodic event from Scheduler

Change-Id: I66563ec50a54e959974b516ae45357bc4797b67f
Refs: #1670
diff --git a/src/util/scheduler.cpp b/src/util/scheduler.cpp
index 9cf2357..d51f83d 100644
--- a/src/util/scheduler.cpp
+++ b/src/util/scheduler.cpp
@@ -63,10 +63,8 @@
 };
 
 Scheduler::EventInfo::EventInfo(const time::nanoseconds& after,
-                                const time::nanoseconds& period,
                                 const Event& event)
   : m_scheduledTime(time::steady_clock::now() + after)
-  , m_period(period)
   , m_event(event)
 {
 }
@@ -74,7 +72,6 @@
 Scheduler::EventInfo::EventInfo(const time::steady_clock::TimePoint& when,
                                 const EventInfo& previousEvent)
   : m_scheduledTime(when)
-  , m_period(previousEvent.m_period)
   , m_event(previousEvent.m_event)
   , m_eventId(previousEvent.m_eventId)
 {
@@ -102,15 +99,7 @@
 Scheduler::scheduleEvent(const time::nanoseconds& after,
                          const Event& event)
 {
-  return schedulePeriodicEvent(after, time::nanoseconds(-1), event);
-}
-
-EventId
-Scheduler::schedulePeriodicEvent(const time::nanoseconds& after,
-                                 const time::nanoseconds& period,
-                                 const Event& event)
-{
-  EventQueue::iterator i = m_events.insert(EventInfo(after, period, event));
+  EventQueue::iterator i = m_events.insert(EventInfo(after, event));
 
   // On OSX 10.9, boost, and C++03 the following doesn't work without ndn::
   // because the argument-dependent lookup prefers STL to boost
@@ -178,19 +167,8 @@
       EventQueue::iterator head = m_events.begin();
 
       Event event = head->m_event;
-      if (head->m_period < time::nanoseconds::zero())
-        {
-          head->m_eventId->invalidate();
-          m_events.erase(head);
-        }
-      else
-        {
-          // "reschedule" and update EventId data of the event
-          EventInfo event(now + head->m_period, *head);
-          EventQueue::iterator i = m_events.insert(event);
-          i->m_eventId->reset(i);
-          m_events.erase(head);
-        }
+      head->m_eventId->invalidate();
+      m_events.erase(head);
 
       event();
     }
diff --git a/src/util/scheduler.hpp b/src/util/scheduler.hpp
index 1e5b80a..bf6ada5 100644
--- a/src/util/scheduler.hpp
+++ b/src/util/scheduler.hpp
@@ -53,16 +53,6 @@
   scheduleEvent(const time::nanoseconds& after, const Event& event);
 
   /**
-   * \brief Schedule periodic event that should be fired every specified period.
-   *        First event will be fired after the specified delay.
-   * \returns EventId that can be used to cancel the scheduled event
-   */
-  EventId
-  schedulePeriodicEvent(const time::nanoseconds& after,
-                        const time::nanoseconds& period,
-                        const Event& event);
-
-  /**
    * \brief Cancel scheduled event
    */
   void
@@ -75,9 +65,7 @@
 private:
   struct EventInfo
   {
-    EventInfo(const time::nanoseconds& after,
-              const time::nanoseconds& period,
-              const Event& event);
+    EventInfo(const time::nanoseconds& after, const Event& event);
 
     EventInfo(const time::steady_clock::TimePoint& when, const EventInfo& previousEvent);
 
@@ -97,7 +85,6 @@
     expiresFromNow() const;
 
     time::steady_clock::TimePoint m_scheduledTime;
-    time::nanoseconds m_period;
     Event m_event;
     mutable EventId m_eventId;
   };
diff --git a/tests/unit-tests/util/test-scheduler.cpp b/tests/unit-tests/util/test-scheduler.cpp
index 4ef4ed1..a046b93 100644
--- a/tests/unit-tests/util/test-scheduler.cpp
+++ b/tests/unit-tests/util/test-scheduler.cpp
@@ -33,7 +33,6 @@
     : count1(0)
     , count2(0)
     , count3(0)
-    , count4(0)
   {
   }
 
@@ -57,16 +56,9 @@
     ++count3;
   }
 
-  void
-  event4()
-  {
-    ++count4;
-  }
-
   int count1;
   int count2;
   int count3;
-  int count4;
 };
 
 BOOST_FIXTURE_TEST_CASE(Events, SchedulerFixture)
@@ -84,15 +76,11 @@
   i = scheduler.scheduleEvent(time::milliseconds(50), bind(&SchedulerFixture::event2, this));
   scheduler.cancelEvent(i);
 
-  i = scheduler.schedulePeriodicEvent(time::milliseconds(1500), time::milliseconds(500), bind(&SchedulerFixture::event4, this));
-  scheduler.scheduleEvent(time::seconds(4), bind(&Scheduler::cancelEvent, &scheduler, i));
-
   io.run();
 
   BOOST_CHECK_EQUAL(count1, 1);
   BOOST_CHECK_EQUAL(count2, 0);
   BOOST_CHECK_EQUAL(count3, 1);
-  BOOST_CHECK_GE(count4, 2);
 }
 
 BOOST_AUTO_TEST_CASE(CancelEmptyEvent)