Improved throughput

- Improved performance by adding the message buffers to a sync.Pool.
- Fixed issue with computing "next" key-pair upon
  receiving a response message.
This commit is contained in:
Mathias Hall-Andersen
2017-07-14 14:25:18 +02:00
parent 0043008ad0
commit 8993b3927c
4 changed files with 79 additions and 41 deletions

View File

@@ -128,7 +128,7 @@ func (peer *Peer) BeginHandshakeInitiation() (*QueueOutboundElement, error) {
// marshal & schedule for sending
writer := bytes.NewBuffer(elem.data[:0])
writer := bytes.NewBuffer(elem.buffer[:0])
binary.Write(writer, binary.LittleEndian, msg)
elem.packet = writer.Bytes()
peer.mac.AddMacs(elem.packet)