Skip to content

Commit 35ce950

Browse files
committed
enhance get type(thread). thread type is same per vxid
1 parent dfcf161 commit 35ce950

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/varnishapi.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,8 +1736,9 @@ def _callBack(self, vsl, pt, fo):
17361736
'vxid': tra.vxid,
17371737
'vxid_parent': tra.vxid_parent,
17381738
'reason': tra.reason,
1739+
'type': None,
17391740
}
1740-
1741+
17411742
while 1:
17421743
i = self.lva.VSL_Next(tra.c)
17431744
if i < 0:
@@ -1747,16 +1748,17 @@ def _callBack(self, vsl, pt, fo):
17471748
if not self.lva.VSL_Match(self.vsl, tra.c):
17481749
continue
17491750

1750-
# decode vxid type ...
1751+
# decode length tag type(thread)...
17511752
ptr = tra.c[0].rec.ptr
17521753
cbd['length'] = ptr[0] & 0xffff
17531754
cbd['tag'] = self.VSL_TAG(ptr)
1754-
if ptr[1] & (1 << 30):
1755-
cbd['type'] = 'c'
1756-
elif ptr[1] & (1 << 31):
1757-
cbd['type'] = 'b'
1758-
else:
1759-
cbd['type'] = '-'
1755+
if cbd['type'] is None:
1756+
if ptr[1] & 0x40000000: #1<<30
1757+
cbd['type'] = 'c'
1758+
elif ptr[1] & 0x80000000: #1<<31
1759+
cbd['type'] = 'b'
1760+
else:
1761+
cbd['type'] = '-'
17601762
cbd['isbin'] = self.VSL_tagflags[cbd['tag']] & self.defi.SLT_F_BINARY
17611763
isbin = cbd['isbin'] == self.defi.SLT_F_BINARY or not self.dataDecode
17621764
cbd['data'] = self.VSL_DATA(ptr, isbin)

0 commit comments

Comments
 (0)