miekg/dns — pull request #157 by FiloSottile (2014-12-06 03:09:08+00:00)
Title: Fix some intermittent errors

Hello! I hunted down some errors that would show up randomly in tests (try running `go test` in a loop).

The first 2 commits are just to clear up a couple things that confused me while diving in. In particular I changed some functions names since pack/unpack are usually associated with encode/decode and it was surprising to see them do the exact opposite. I changed them to a more explicit to/from.

Then the following 3 commits fix a quite serious bug: **int to bytes conversions were variable-length**, so the leading 0-bytes were dropped if present by chance, leading to malformed keys/signatures in a certain % of cases when using [EC]DSA. I'm happy to say that this fixes the bug detected by the test I left disabled with a TODO some time ago.

The final 2 commits fix some race conditions in the server tests.

---

I've had `go test` running in a loop for a while now and it looks like I squashed them all :v: