forked from urdt/ussd
remove init and use Exec
This commit is contained in:
parent
b66891a646
commit
e6e701a609
@ -96,7 +96,7 @@ func main() {
|
|||||||
en = en.WithDebug(nil)
|
en = en.WithDebug(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = en.Init(ctx)
|
_, err = en.Exec(ctx, []byte{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "engine init exited with error: %v\n", err)
|
fmt.Fprintf(os.Stderr, "engine init exited with error: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -71,19 +71,7 @@ func(f *BaseSessionHandler) Process(rqs RequestSession) (RequestSession, error)
|
|||||||
}
|
}
|
||||||
rqs.Engine = en
|
rqs.Engine = en
|
||||||
|
|
||||||
r, err = rqs.Engine.Init(rqs.Ctx)
|
r, err = rqs.Engine.Exec(rqs.Ctx, rqs.Input)
|
||||||
if err != nil {
|
|
||||||
perr := f.provider.Put(rqs.Config.SessionId, rqs.Storage)
|
|
||||||
rqs.Storage = nil
|
|
||||||
if perr != nil {
|
|
||||||
logg.ErrorCtxf(rqs.Ctx, "", "storage put error", perr)
|
|
||||||
}
|
|
||||||
return rqs, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if r && len(rqs.Input) > 0 {
|
|
||||||
r, err = rqs.Engine.Exec(rqs.Ctx, rqs.Input)
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
perr := f.provider.Put(rqs.Config.SessionId, rqs.Storage)
|
perr := f.provider.Put(rqs.Config.SessionId, rqs.Storage)
|
||||||
rqs.Storage = nil
|
rqs.Storage = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user