Refactor SetRcode, rd bit is now set properly for error packets

I noticed the rd bit was not being set for error packets. Some clients use this to determine if the server accepts recursive requests (at least `dig` does). Regardless, the response rd bit should always be the same as the request rd bit. While fixing this I noticed that `SetReply` has the proper functionality, and is almost equivalent to `SetRcode`. So I refactored the code.