Heartbeat refresh fixes, device dropped on lost

Device is dropped when lost again
a status=online message is sent to the server when a device comes out of
stale
Also, on earlier versions of glibc, you need a linker flag for some time
stuff, so I added that too
Quick tweak for when to send a hbrefresh
Merge branch 'testing'