Only check for the stratum clean message if we have had a valid message.
Reset the work_restart bool after the scanwork loop in case the driver flushes work synchronously.
--shares should be scaled to diff1 not absolute number of shares
Initialise the stgd lock mutex earlier to prevent dereferences when pool testing occurs before it.

Conflicts:
	cgminer.c
util.c: Decreasing reference count on allocated JSON obects to prevent memory leak