Fix initial sleep time, clean up debug logging.
Get and cache lifetime after successful read.
Fix regression with session lifetime calculation.
Merge pull request #1 from colinmollenhour/master

update