fb55/bitfield — pull request #10 by fisch0920 (2014-05-07 08:33:25+00:00)
Title: Important fix for bitfields of non-multiple-of-8 length

Previously a buffer of say size 13 would incorrectly yield a 3-byte bitfield, whereas with this change it correctly yields a 2-byte bitfield by rounding up to the next multiple of 8 as opposed to naively adding 8 and then rounding up. This change has very important correctness implications for implementing bittorrent because if a client building off of bitfield sends a bitfield message with the wrong size, existing clients will realize the error and kill the connection as per the unofficial spec.