Browse Source

Watch API.

cl-refactor
Gav Wood 10 years ago
parent
commit
eda9393fd0
  1. 2
      libethereum/Client.h
  2. 3
      libp2p/Host.cpp
  3. 25
      libwhisper/Interface.h

2
libethereum/Client.h

@ -285,7 +285,7 @@ private:
State m_preMine; ///< The present state of the client.
State m_postMine; ///< The state of the client which we're mining (i.e. it'll have all the rewards added).
std::weak_ptr<EthereumHost> m_host; ///< Our Ethereum Host. Don't do anything if we can't lock.
std::weak_ptr<EthereumHost> m_host; ///< Our Ethereum Host. Don't do anything if we can't lock.
std::vector<Miner> m_miners;
mutable boost::shared_mutex x_miners;

3
libp2p/Host.cpp

@ -143,6 +143,9 @@ void Host::stop()
void Host::quit()
{
// called to force io_service to kill any remaining tasks it might have -
// such tasks may involve socket reads from Capabilities that maintain references
// to resources we're about to free.
stop();
m_ioService.reset();
// m_acceptor & m_socket are DANGEROUS now.

25
libwhisper/Interface.h

@ -43,6 +43,8 @@ namespace shh
Topic mask;
};*/
class Watch;
struct InstalledFilter
{
InstalledFilter(TopicFilter const& _f): filter(_f) {}
@ -87,9 +89,11 @@ struct WatshhChannel: public dev::LogChannel { static const char* name() { retur
}
}
/*
namespace std { void swap(shh::Watch& _a, shh::Watch& _b); }
namespace std { void swap(dev::shh::Watch& _a, dev::shh::Watch& _b); }
namespace dev
{
namespace shh
{
@ -99,28 +103,29 @@ class Watch: public boost::noncopyable
public:
Watch() {}
Watch(Whisper& _c, h256 _f): m_c(&_c), m_id(_c.installWatch(_f)) {}
Watch(Whisper& _c, TopicFilter const& _tf): m_c(&_c), m_id(_c.installWatch(_tf)) {}
Watch(Interface& _c, TopicMask const& _f): m_c(&_c), m_id(_c.installWatch(_f)) {}
Watch(Interface& _c, TopicFilter const& _tf): m_c(&_c), m_id(_c.installWatch(_tf)) {}
~Watch() { if (m_c) m_c->uninstallWatch(m_id); }
bool check() { return m_c ? m_c->checkWatch(m_id) : false; }
bool peek() { return m_c ? m_c->peekWatch(m_id) : false; }
h256s check() { return m_c ? m_c->checkWatch(m_id) : h256s(); }
h256s peek() { return m_c ? m_c->peekWatch(m_id) : h256s(); }
private:
Whisper* m_c;
Interface* m_c;
unsigned m_id;
};
}
}
namespace shh
namespace std
{
inline void swap(shh::Watch& _a, shh::Watch& _b)
inline void swap(dev::shh::Watch& _a, dev::shh::Watch& _b)
{
swap(_a.m_c, _b.m_c);
swap(_a.m_id, _b.m_id);
}
}
*/

Loading…
Cancel
Save