slave_loop(): Add function process_reply() to clean the code.