Browse Source

fixed #675. I2LUA define

pull/676/head
orignal 8 years ago
parent
commit
442a0c48e7
  1. 2
      Destination.cpp
  2. 15
      Destination.h
  3. 1
      NetDb.h

2
Destination.cpp

@ -716,6 +716,7 @@ namespace client
return false; return false;
} }
#ifdef I2LUA
void ClientDestination::Ready(ReadyPromise & p) void ClientDestination::Ready(ReadyPromise & p)
{ {
ScheduleCheckForReady(&p); ScheduleCheckForReady(&p);
@ -739,6 +740,7 @@ namespace client
else // we are not ready else // we are not ready
ScheduleCheckForReady(p); ScheduleCheckForReady(p);
} }
#endif
void ClientDestination::HandleDataMessage (const uint8_t * buf, size_t len) void ClientDestination::HandleDataMessage (const uint8_t * buf, size_t len)
{ {

15
Destination.h

@ -8,7 +8,9 @@
#include <set> #include <set>
#include <string> #include <string>
#include <functional> #include <functional>
#ifdef I2LUA
#include <future> #include <future>
#endif
#include <boost/asio.hpp> #include <boost/asio.hpp>
#include "Identity.h" #include "Identity.h"
#include "TunnelPool.h" #include "TunnelPool.h"
@ -145,18 +147,19 @@ namespace client
class ClientDestination: public LeaseSetDestination class ClientDestination: public LeaseSetDestination
{ {
public: public:
#ifdef I2LUA
// type for informing that a client destination is ready // type for informing that a client destination is ready
typedef std::promise<std::shared_ptr<ClientDestination> > ReadyPromise; typedef std::promise<std::shared_ptr<ClientDestination> > ReadyPromise;
// informs promise with shared_from_this() when this destination is ready to use
// if cancelled before ready, informs promise with nullptr
void Ready(ReadyPromise & p);
#endif
ClientDestination (const i2p::data::PrivateKeys& keys, bool isPublic, const std::map<std::string, std::string> * params = nullptr); ClientDestination (const i2p::data::PrivateKeys& keys, bool isPublic, const std::map<std::string, std::string> * params = nullptr);
~ClientDestination (); ~ClientDestination ();
bool Start (); bool Start ();
bool Stop (); bool Stop ();
// informs promise with shared_from_this() when this destination is ready to use
// if cancelled before ready, informs promise with nullptr
void Ready(ReadyPromise & p);
const i2p::data::PrivateKeys& GetPrivateKeys () const { return m_Keys; }; const i2p::data::PrivateKeys& GetPrivateKeys () const { return m_Keys; };
void Sign (const uint8_t * buf, int len, uint8_t * signature) const { m_Keys.Sign (buf, len, signature); }; void Sign (const uint8_t * buf, int len, uint8_t * signature) const { m_Keys.Sign (buf, len, signature); };
@ -191,10 +194,10 @@ namespace client
std::shared_ptr<ClientDestination> GetSharedFromThis () std::shared_ptr<ClientDestination> GetSharedFromThis ()
{ return std::static_pointer_cast<ClientDestination>(shared_from_this ()); } { return std::static_pointer_cast<ClientDestination>(shared_from_this ()); }
void PersistTemporaryKeys (); void PersistTemporaryKeys ();
#ifdef I2LUA
void ScheduleCheckForReady(ReadyPromise * p); void ScheduleCheckForReady(ReadyPromise * p);
void HandleCheckForReady(const boost::system::error_code & ecode, ReadyPromise * p); void HandleCheckForReady(const boost::system::error_code & ecode, ReadyPromise * p);
#endif
private: private:
i2p::data::PrivateKeys m_Keys; i2p::data::PrivateKeys m_Keys;

1
NetDb.h

@ -8,7 +8,6 @@
#include <string> #include <string>
#include <thread> #include <thread>
#include <mutex> #include <mutex>
#include <future>
#include "Base.h" #include "Base.h"
#include "Gzip.h" #include "Gzip.h"

Loading…
Cancel
Save