File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ func (alloc *defaultAllocator) Get(size int) []byte {
8989// which the cap must be exactly 2^n
9090func (alloc * defaultAllocator ) Put (buf []byte ) error {
9191 bits := msb (cap (buf ))
92- if cap (buf ) == 0 || cap ( buf ) < 64 || cap (buf ) > 65536 || cap (buf ) != 1 << bits {
92+ if cap (buf ) < 64 || cap (buf ) > 65536 || cap (buf ) != 1 << bits {
9393 return errors .New ("allocator Put() incorrect buffer size" )
9494 }
9595 bits -= 6
Original file line number Diff line number Diff line change 88 "sync"
99 "time"
1010
11+ "github.com/sagernet/sing/common"
1112 "github.com/sagernet/sing/common/buf"
1213 "github.com/sagernet/sing/common/canceler"
1314 M "github.com/sagernet/sing/common/metadata"
@@ -108,6 +109,7 @@ func (c *natConn) SetTimeout(timeout time.Duration) bool {
108109func (c * natConn ) Close () error {
109110 c .closeOnce .Do (func () {
110111 close (c .doneChan )
112+ common .Close (c .handler )
111113 })
112114 return nil
113115}
You can’t perform that action at this time.
0 commit comments