Fix several missing brackets and logic errors

This commit fixes several subtle issues in the library:

- IS_REFRESHING() (in confmon.c) should be defined with parens around
  the expression; since in the current implementation when used with
  !IS_REFRESHING (where the comparison is bitwise) the left operand gets
  evaluated first with the `!` operator and then the `&` operator

- Fixed several variable chcks in proper conditionals

- Fixed mismatched variable checks (when we should be checking another
  variable)

Change-Id: Ib7be07367162d46fb971e90a96eba7360f6e80b5
Reviewed-on: http://review.couchbase.org/43711
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>