exit on repeated duplicate shares (to enhance)

create a new function proper_exit() to do common stuff on exit...
debug: a new boolean to log or not json rpc data
stratum: handle a small cache of submitted jobs

Prevent to send duplicated shares on some pools like hashharder..

remove exit on repeated duplicate shares,
    the submitted cache now handles this problem.

Signed-off-by: Tanguy Pruvot <tanguy.pruvot@gmail.com>