Tidy up main() a bit by creating loop_handle_errors() and loop_handle_reads_writes().
Tidy up main() a bit by creating loop_handle_errors() and
loop_handle_reads_writes().

tempbottle/mosquitto,tempbottle/mosquitto,tempbottle/mosquitto,tempbottle/mosquitto,tempbottle/mosquitto