miekg/dns — pull request #66 by armon (2014-01-03 23:20:58+00:00)
Title: Simplify the Write() for TCP based connections

Simplify the code path by using io.Copy to handle partial writes. Allocate `l` large enough to avoid a re-allocation. Potential short write fix.

One thing I wanted to ask about, it seems that the old version of the code did the following:
1) set lm := len(m)
2) Prefix m with 2 bytes
3) Send up to lm bytes, which is 2 bytes short of the length of m

Please let me know if I'm missing something obvious. I also don't know DNS protocol deeply, so not sure if those bytes are not needed.