Add Datagram.len

This commit is contained in:
Mark Spanbroek 2020-10-29 10:36:01 +01:00 committed by markspanbroek
parent 74dc38d01c
commit cfa6df32c0
2 changed files with 5 additions and 1 deletions

View File

@ -5,3 +5,7 @@ type
data*: seq[byte]
ecn*: ECN
DatagramBuffer* = openArray[byte]
proc len*(datagram: Datagram): int =
datagram.data.len

View File

@ -7,7 +7,7 @@ suite "udp":
test "writes packets to datagrams":
let client = newClientConnection(zeroAddress, zeroAddress)
check client.write().data.len > 0
check client.write().len > 0
test "reads packets from datagram":
let client = newClientConnection(zeroAddress, zeroAddress)