Force the resync count to be an integer.
Tidy up some confusing code relating to resync counts.
Simplify the if test by removing extra duplicate test.
Merge pull request #58 from Metaswitch/issue56

Improve resync handling code, resolving issue56