clean closure api
diff --git a/ccnx/ccnx-closure.cpp b/ccnx/ccnx-closure.cpp
index 528c721..bc9b244 100644
--- a/ccnx/ccnx-closure.cpp
+++ b/ccnx/ccnx-closure.cpp
@@ -2,15 +2,15 @@
namespace Ccnx {
-Closure::Closure(int retry, const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback)
- : m_retry(retry), m_timeoutCallback(NULL), m_dataCallback(NULL)
+Closure::Closure(const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback)
+ : m_timeoutCallback(NULL), m_dataCallback(NULL)
{
m_timeoutCallback = new TimeoutCallback (timeoutCallback);
m_dataCallback = new DataCallback (dataCallback);
}
Closure::Closure(const Closure &other)
- :m_retry(other.m_retry), m_timeoutCallback(NULL), m_dataCallback(NULL)
+ : m_timeoutCallback(NULL), m_dataCallback(NULL)
{
m_timeoutCallback = new TimeoutCallback(*(other.m_timeoutCallback));
m_dataCallback = new DataCallback(*(other.m_dataCallback));
diff --git a/ccnx/ccnx-closure.h b/ccnx/ccnx-closure.h
index f006d11..1bcaa06 100644
--- a/ccnx/ccnx-closure.h
+++ b/ccnx/ccnx-closure.h
@@ -21,10 +21,8 @@
typedef boost::function<TimeoutCallbackReturnValue (const Name &)> TimeoutCallback;
- Closure(int retry, const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback = TimeoutCallback());
+ Closure(const DataCallback &dataCallback, const TimeoutCallback &timeoutCallback = TimeoutCallback());
Closure(const Closure &other);
- int getRetry() {return m_retry;}
- void decRetry() { m_retry--;}
virtual ~Closure();
virtual void
runDataCallback(const Name &name, const Bytes &content);
@@ -35,7 +33,6 @@
dup() const;
protected:
- int m_retry;
TimeoutCallback *m_timeoutCallback;
DataCallback *m_dataCallback;
};
diff --git a/ccnx/ccnx-tunnel.cpp b/ccnx/ccnx-tunnel.cpp
index dfefc8b..0808663 100644
--- a/ccnx/ccnx-tunnel.cpp
+++ b/ccnx/ccnx-tunnel.cpp
@@ -118,8 +118,8 @@
m_rit.erase(prefix);
}
-TunnelClosure::TunnelClosure(int retry, const DataCallback &dataCallback, CcnxTunnel *tunnel, const Name &originalInterest, const TimeoutCallback &timeoutCallback)
- : Closure(retry, dataCallback, timeoutCallback)
+TunnelClosure::TunnelClosure(const DataCallback &dataCallback, CcnxTunnel *tunnel, const Name &originalInterest, const TimeoutCallback &timeoutCallback)
+ : Closure(dataCallback, timeoutCallback)
, m_tunnel(tunnel)
, m_originalInterest(originalInterest)
{
@@ -134,7 +134,7 @@
Closure *
TunnelClosure::dup() const
{
- Closure *closure = new TunnelClosure(m_retry, *m_dataCallback, m_tunnel, m_originalInterest, *m_timeoutCallback);
+ Closure *closure = new TunnelClosure(*m_dataCallback, m_tunnel, m_originalInterest, *m_timeoutCallback);
return closure;
}
diff --git a/ccnx/ccnx-tunnel.h b/ccnx/ccnx-tunnel.h
index 104c7cf..05f981a 100644
--- a/ccnx/ccnx-tunnel.h
+++ b/ccnx/ccnx-tunnel.h
@@ -89,7 +89,7 @@
class TunnelClosure : public Closure
{
public:
- TunnelClosure(int retry, const DataCallback &dataCallback, CcnxTunnel *tunnel, const Name &originalInterest, const TimeoutCallback &timeoutCallback = TimeoutCallback());
+ TunnelClosure(const DataCallback &dataCallback, CcnxTunnel *tunnel, const Name &originalInterest, const TimeoutCallback &timeoutCallback = TimeoutCallback());
TunnelClosure(const Closure *closure, CcnxTunnel *tunnel, const Name &originalInterest);
diff --git a/ccnx/ccnx-wrapper.cpp b/ccnx/ccnx-wrapper.cpp
index 637b9af..b014a07 100644
--- a/ccnx/ccnx-wrapper.cpp
+++ b/ccnx/ccnx-wrapper.cpp
@@ -247,18 +247,16 @@
break;
case CCN_UPCALL_INTEREST_TIMED_OUT: {
- if (cp != NULL && cp->getRetry() > 0) {
- cp->decRetry();
- return CCN_UPCALL_RESULT_REEXPRESS;
- }
-
- Name interest(info->interest_ccnb, info->interest_comps);
- Closure::TimeoutCallbackReturnValue rv = cp->runTimeoutCallback(interest);
- switch(rv)
+ if (cp != NULL)
{
- case Closure::RESULT_OK : return CCN_UPCALL_RESULT_OK;
- case Closure::RESULT_REEXPRESS : return CCN_UPCALL_RESULT_REEXPRESS;
- default : break;
+ Name interest(info->interest_ccnb, info->interest_comps);
+ Closure::TimeoutCallbackReturnValue rv = cp->runTimeoutCallback(interest);
+ switch(rv)
+ {
+ case Closure::RESULT_OK : return CCN_UPCALL_RESULT_OK;
+ case Closure::RESULT_REEXPRESS : return CCN_UPCALL_RESULT_REEXPRESS;
+ default : break;
+ }
}
return CCN_UPCALL_RESULT_OK;
}