/* Called on connect timeout and more. The PCB has been released when this function is called.  */
static void on_tcp_err(void *arg_p, err_t err)
/* Called on connect timeout and more. The PCB has been released when this function is called.  */
static void on_tcp_err(void *arg_p, err_t err)
{
    struct socket_t *socket_p = arg_p;
    socket_p->pcb_p = NULL;
    if (socket_p->output.cb.state == STATE_CONNECT) {
        socket_p->output.cb.state = STATE_CLOSED;
        resume_thrd(socket_p->input.cb.thrd_p, -1);
    }
}