Browse Source

Fix for filters/watches.

cl-refactor
Gav Wood 10 years ago
parent
commit
6e62485aa2
  1. 12
      CMakeLists.txt
  2. 7
      libethereum/Client.cpp
  3. 5
      libethereum/Client.h

12
CMakeLists.txt

@ -49,7 +49,7 @@ endfunction()
function(createBuildInfo)
# Set build platform; to be written to BuildInfo.h
set(ETH_BUILD_PLATFORM ${TARGET_PLATFORM})
set(ETH_BUILD_PLATFORM "${TARGET_PLATFORM}")
if (CMAKE_COMPILER_IS_MINGW)
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/mingw")
elseif (CMAKE_COMPILER_IS_MSYS)
@ -64,6 +64,16 @@ function(createBuildInfo)
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/unknown")
endif ()
if (EVMJIT)
set(ETH_BUILD_PLATFORM "${TARGET_PLATFORM}/JIT")
else ()
set(ETH_BUILD_PLATFORM "${TARGET_PLATFORM}/int")
endif ()
if (PARANOIA)
set(ETH_BUILD_PLATFORM "${TARGET_PLATFORM}/PARA")
endif ()
#cmake build type may be not specified when using msvc
if (CMAKE_BUILD_TYPE)
set(_cmake_build_type ${CMAKE_BUILD_TYPE})

7
libethereum/Client.cpp

@ -185,6 +185,8 @@ unsigned Client::installWatch(h256 _h)
cwatch << "+++" << ret << _h;
}
auto ch = logs(ret);
if (ch.empty())
ch.push_back(InitialChange);
{
Guard l(m_filterLock);
swap(m_watches[ret].changes, ch);
@ -229,9 +231,10 @@ void Client::noteChanged(h256Set const& _filters)
if (_filters.count(i.second.id))
{
// cwatch << "!!!" << i.first << i.second.id;
try {
if (m_filters.count(i.second.id))
i.second.changes += m_filters.at(i.second.id).changes;
} catch(...){}
else
i.second.changes.push_back(LocalisedLogEntry(SpecialLogEntry, 0));
}
// clear the filters now.
for (auto& i: m_filters)

5
libethereum/Client.h

@ -84,13 +84,16 @@ struct InstalledFilter
static const h256 PendingChangedFilter = u256(0);
static const h256 ChainChangedFilter = u256(1);
static const LogEntry SpecialLogEntry = LogEntry(Address(), h256s(), bytes());
static const LocalisedLogEntry InitialChange(SpecialLogEntry, 0);
struct ClientWatch
{
ClientWatch() {}
explicit ClientWatch(h256 _id): id(_id) {}
h256 id;
LocalisedLogEntries changes;
LocalisedLogEntries changes = { InitialChange };
};
struct WatchChannel: public LogChannel { static const char* name() { return "(o)"; } static const int verbosity = 7; };

Loading…
Cancel
Save