Skip to content

Commit 46d2be9

Browse files
committed
Unneeded if/el branch
1 parent 44dae6d commit 46d2be9

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

hpack/table.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,11 @@ def add(self, name, value):
130130
We reduce the table size if the entry will make the
131131
table size greater than maxsize.
132132
"""
133-
# Obviously we never add items to 0 sized table
134-
if self._maxsize <= 0:
135-
return
136-
# We also just clear the table if the entry is to big
137-
elif self._entry_size(name, value) > self._maxsize:
133+
# We just clear the table if the entry is to big
134+
if self._entry_size(name, value) > self._maxsize:
138135
self.clear()
139-
return
140-
# Add new entry and shrink to maxsize
141-
else:
136+
# Add new entry if the table actually has a size
137+
elif self._maxsize > 0:
142138
self.appendleft((name,value))
143139
self._shrink()
144140

0 commit comments

Comments
 (0)