Skip to content
Snippets Groups Projects
Commit 4e1a5b90 authored by Jarrod Pas's avatar Jarrod Pas
Browse files

Fixes buffer capacity not being set

parent bcf422a9
No related branches found
No related tags found
2 merge requests!3Version 0.2,!1Full rewrite
......@@ -227,7 +227,7 @@ class Packet:
class Buffer:
"""A place for a node to hold packets."""
def __init__(self, **options):
def __init__(self, capacity=None, **options):
"""
Create a buffer.
......@@ -237,7 +237,10 @@ class Buffer:
Keyword arguments:
capacity -- the maximum number of packets to hold (default infinity).
"""
self.capacity = options.get('capacity', float('inf'))
if capacity is None:
self.capacity = float('inf')
else:
self.capacity = capacity
self.store = OrderedDict()
@property
......@@ -280,7 +283,7 @@ class Node:
"""Create a node."""
self.network = None
self.buffer = Buffer()
self.buffer = Buffer(capacity=options.get('buffer_capacity', None))
self._neighbours = set()
self.options = ChainMap(options, {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment