From 6df345632c448239968930619671a4c7c21230ff Mon Sep 17 00:00:00 2001 From: xuleiming Date: Tue, 3 Dec 2024 11:14:20 +0800 Subject: [PATCH] fix OnPluginStart --- bfe_modules/mod_wasmplug/conf_mod_wasmplug.go | 2 +- bfe_wasmplug/plugin.go | 9 ++++++--- go.mod | 8 +++++--- go.sum | 2 ++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/bfe_modules/mod_wasmplug/conf_mod_wasmplug.go b/bfe_modules/mod_wasmplug/conf_mod_wasmplug.go index 10406709..4899a174 100644 --- a/bfe_modules/mod_wasmplug/conf_mod_wasmplug.go +++ b/bfe_modules/mod_wasmplug/conf_mod_wasmplug.go @@ -136,7 +136,7 @@ func updatePluginConf(t *PluginTable, conf PluginConfFile, pluginPath string) er return err } - plug.OnPluginStart() + // plug.OnPluginStart() pluginMapNew[pn] = &plug } diff --git a/bfe_wasmplug/plugin.go b/bfe_wasmplug/plugin.go index fd97e1dd..326cc732 100644 --- a/bfe_wasmplug/plugin.go +++ b/bfe_wasmplug/plugin.go @@ -236,6 +236,7 @@ func (w *wasmPluginImpl) EnsureInstanceNum(num int) int { continue } + w.OnInstanceStart(instance) newInstance = append(newInstance, instance) } @@ -311,8 +312,7 @@ func (w *wasmPluginImpl) ReleaseInstance(instance common.WasmInstance) { atomic.AddInt32(&w.occupy, -1) } -func (w *wasmPluginImpl) OnPluginStart() { - w.Exec(func(instance common.WasmInstance) bool { +func (w *wasmPluginImpl) OnInstanceStart(instance common.WasmInstance) bool { abi := wasmABI.GetABIList(instance)[0] var exports v1Host.Exports if abi != nil { @@ -356,7 +356,10 @@ func (w *wasmPluginImpl) OnPluginStart() { } return true - }) +} + +func (w *wasmPluginImpl) OnPluginStart() { + // w.Exec(w.OnInstanceStart) } func (d *wasmPluginImpl) OnPluginDestroy() {} diff --git a/go.mod b/go.mod index 77d08a51..d1b2abf8 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,6 @@ require ( github.com/armon/go-radix v1.0.0 github.com/asergeyev/nradix v0.0.0-20170505151046-3872ab85bb56 // indirect github.com/baidu/go-lib v0.0.0-20200819072111-21df249f5e6a - github.com/bfenetworks/proxy-wasm-go-host v0.2.1-0.20230626122511-25a9e133320e github.com/golang-jwt/jwt v3.2.2+incompatible github.com/gomodule/redigo v2.0.0+incompatible github.com/json-iterator/go v1.1.12 @@ -40,7 +39,10 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect ) -require github.com/go-jose/go-jose/v4 v4.0.4 +require ( + github.com/bfenetworks/proxy-wasm-go-host v0.0.0-20241202144118-62704e5df808 + github.com/go-jose/go-jose/v4 v4.0.4 +) require ( github.com/HdrHistogram/hdrhistogram-go v1.0.1 // indirect @@ -67,4 +69,4 @@ require ( howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect ) -replace github.com/bfenetworks/proxy-wasm-go-host => ../proxy-wasm-go-host +// replace github.com/bfenetworks/proxy-wasm-go-host => ../proxy-wasm-go-host diff --git a/go.sum b/go.sum index c93e20f9..6532d853 100644 --- a/go.sum +++ b/go.sum @@ -16,6 +16,8 @@ github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuP github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/baidu/go-lib v0.0.0-20200819072111-21df249f5e6a h1:m/u39GNhkoUSC9WxTuM5hWShEqEfVioeXDiqiQd6tKg= github.com/baidu/go-lib v0.0.0-20200819072111-21df249f5e6a/go.mod h1:FneHDqz3wLeDGdWfRyW4CzBbCwaqesLGIFb09N80/ww= +github.com/bfenetworks/proxy-wasm-go-host v0.0.0-20241202144118-62704e5df808 h1:v0ckUMaZJFe8XvoM9x3kn+lDtMfI9EvpFadiOiV/s8A= +github.com/bfenetworks/proxy-wasm-go-host v0.0.0-20241202144118-62704e5df808/go.mod h1:VG3ZZ8Zg7dYkla2hHy9UsX0GLl/dgJYP4IxuPvoq+/U= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cucumber/godog v0.8.1 h1:lVb+X41I4YDreE+ibZ50bdXmySxgRviYFgKY6Aw4XE8=