Use upstream broadcast code.

I wrote the code for this project, but I've copied it into two other
projects since, so I figured I'd have one place to fix bugs, etc...