+ /*
+ * The application registration thread now owns the application socket
+ * and the global thread state. The thread state is used to wait for
+ * the thread's status, but its ownership now belongs to the thread.
+ */
+ application_socket = -1;
+ if (!wait_thread_status(thread_state)) {
+ thread_state = NULL;
+ goto error;