Refactor client acceptance code

wait_for_client() now initiates the incoming client loop. The function
accepts the server listener socket, as well as a function pointer to a
client handler function. This client handler function will process each
client connection. At the moment, handle_socket() is exclusively used
here.