now acquires a lock between sending a connect_ack and updating the client_sockets. This ensures that no data is sent before the connect_ack.