Common Lisp socket client - reconnect on failure

I m working on an IMAP client for Common Lisp. Details about that in a future post, but I d like to share here a few bits of code that I had to dig for. The CL socket tutorials that I could find focus on how to connect to a server, fetch some data and then disconnect. In my case, however, the connection is supposed to be long lived. There s a thread that continuously reads data from the server (it…