openziti / dilithium

Framework for high-performance streaming over message-passing systems. High-performance WAN protocols over UDP datagrams. Implemented in golang.
Apache License 2.0
13 stars 2 forks source link

Fix Empty ACK Encoding #87

Closed michaelquigley closed 4 years ago

michaelquigley commented 4 years ago

Empty ACK encoding appears to be broken:

func TestEmptyAck(t *testing.T) {
    p := newPool("test", 1024, NewNilInstrument().NewInstance("", nil))
    rtt := uint16(66)
    wm, err := newAck([]ack{}, 55, &rtt, p)
    assert.NoError(t, err)
    fmt.Println(hex.Dump(wm.buffer.data[:wm.buffer.uz]))

    wmOut, err := decodeHeader(wm.buffer)
    assert.NoError(t, err)
    a, rxPortalSz, rttOut, err := wmOut.asAck()
    assert.NoError(t, err)
    assert.Equal(t, 0, len(a))
    assert.Equal(t, int32(55), rxPortalSz)
    assert.Equal(t, rtt, rttOut)
}

...does not work.