Skip to content

Commit

Permalink
Backport: get vm_configuration from base_wasm if available. (envoypro…
Browse files Browse the repository at this point in the history
…xy#456)

Signed-off-by: John Plevyak <jplevyak@gmail.com>
  • Loading branch information
jplevyak authored Mar 17, 2020
1 parent d7fff53 commit 2ee431d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion source/extensions/common/wasm/wasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Wasm : public Logger::Loggable<Logger::Id::wasm>, public std::enable_share

Upstream::ClusterManager& clusterManager() const { return cluster_manager_; }
const std::string& code() const { return code_; }
const std::string& vm_configuration() const { return vm_configuration_; }
const std::string& vm_configuration() const;
bool allow_precompiled() const { return allow_precompiled_; }
void setInitialConfiguration(const std::string& vm_configuration) {
vm_configuration_ = vm_configuration;
Expand Down Expand Up @@ -330,6 +330,12 @@ WasmHandleSharedPtr getOrCreateThreadLocalWasm(WasmHandleSharedPtr base_wasm,
absl::string_view configuration,
Event::Dispatcher& dispatcher);

inline const std::string& Wasm::vm_configuration() const {
if (base_wasm_handle_)
return base_wasm_handle_->wasm()->vm_configuration_;
return vm_configuration_;
}

inline void* Wasm::allocMemory(uint64_t size, uint64_t* address) {
Word a = malloc_(vm_context(), size);
if (!a.u64_) {
Expand Down

0 comments on commit 2ee431d

Please sign in to comment.