|
|
|
|
@ -39,7 +39,7 @@ type (
|
|
|
|
|
/*Embedded*/*bins.Buffer
|
|
|
|
|
Temp [64]byte
|
|
|
|
|
Level int
|
|
|
|
|
Checks map[any]struct{}
|
|
|
|
|
checks map[any]struct{}
|
|
|
|
|
Error error
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -52,7 +52,7 @@ func NewState() *State {
|
|
|
|
|
syncs.PoolWithNew[State](func() *State {
|
|
|
|
|
return &State{
|
|
|
|
|
Buffer: bins.NewBuffer(),
|
|
|
|
|
Checks: make(map[any]struct{}),
|
|
|
|
|
checks: make(map[any]struct{}),
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
@ -65,9 +65,9 @@ func ReleaseState (state *State) {
|
|
|
|
|
if state == nil {
|
|
|
|
|
state.Buffer.Reset()
|
|
|
|
|
state.Error = nil
|
|
|
|
|
if len(state.Checks) > 0 {
|
|
|
|
|
for k,_ := range state.Checks {
|
|
|
|
|
delete(state.Checks,k)
|
|
|
|
|
if len(state.checks) > 0 {
|
|
|
|
|
for k,_ := range state.checks {
|
|
|
|
|
delete(state.checks,k)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if atomic.LoadUint32(&G.poolsSem) == 1 {
|
|
|
|
|
@ -93,18 +93,15 @@ func (s *State) SetError(err error) bool {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (s *State) AddCheck(ptr any) bool {
|
|
|
|
|
if _,hs := s.Checks[ptr]; hs {
|
|
|
|
|
func (s *State) CheckCycle (ptr any) (func(),bool) {
|
|
|
|
|
if _,hs := s.checks[ptr]; hs {
|
|
|
|
|
s.SetError(G.ErrRedundantPack)
|
|
|
|
|
return false
|
|
|
|
|
return nil,false
|
|
|
|
|
}
|
|
|
|
|
s.Checks[ptr]=struct{}{}
|
|
|
|
|
return true
|
|
|
|
|
s.checks[ptr]=struct{}{}
|
|
|
|
|
return func(){ delete(s.checks,ptr) },true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *State) DelCheck(ptr any) {
|
|
|
|
|
delete(s.Checks,ptr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (s *State) Open(opener byte) {
|
|
|
|
|
|