LWIP_CLOSE 调用流程

lwip_close

---lwip_netconn_do_join_leave_group

---netconn_prepare_delete

------lwip_netconn_do_delconn

---------lwip_netconn_do_close_internal

                   tcp_close(tpcb)   or  tcp_shutdown(tpcb, shut_rx, shut_tx)

tcp_input

        tcp_process

               case FIN_WAIT_1:

tcp_close

       tcp_close_shutdown

              tcp_rst

              tcp_free

              tcp_close_shutdown_fin

tcp_shutdown

     tcp_close_shutdown

lwip_netconn_do_close

---tcp_shutdown

---lwip_netconn_do_close_internal

------tcp_close or tcp_shutdown,config null

lwip_shutdown

---netconn_shutdown

netconn_close

---netconn_close_shutdown

------netconn_close_shutdown

netconn_shutdown

---netconn_close_shutdown

------netconn_close_shutdown

netconn_close_shutdown

--netconn_apimsg(lwip_netconn_do_close, &API_MSG_VAR_REF(msg));

       ---lwip_netconn_do_close_internal

        tcp_abort(tpcb);

        tpcb = NULL;

    {

      err = tcp_close(tpcb);

    tcp_set_flags(pcb, TF_RXCLOSED);

      err = tcp_close(tpcb);

    err = tcp_shutdown(tpcb, shut_rx, shut_tx);

          tcp_abort(tpcb);

          err = ERR_OK;

  /* Set back some callback pointers */

  if (shut_close) {

    tcp_arg(tpcb, NULL);

  }

  if (tpcb->state == LISTEN) {

    tcp_accept(tpcb, NULL);

  } else {

    /* some callbacks have to be reset if tcp_close is not successful */

    if (shut_rx) {

      tcp_recv(tpcb, NULL);

      tcp_accept(tpcb, NULL);

    }

    if (shut_tx) {

      tcp_sent(tpcb, NULL);

    }

    if (shut_close) {

      tcp_poll(tpcb, NULL, 0);

      tcp_err(tpcb, NULL);

    }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值