Code:
git diff app/lwip/core/tcp.c
diff --git a/app/lwip/core/tcp.c b/app/lwip/core/tcp.c
index 362b396..f22dbfd 100644
--- a/app/lwip/core/tcp.c
+++ b/app/lwip/core/tcp.c
@@ -107,7 +107,7 @@ struct tcp_pcb *tcp_tmp_pcb;
/** Timer counter to handle calling slow-timer from tcp_tmr() */
static u8_t tcp_timer;
-static u16_t tcp_new_port(void);//【・_・?】
+static u16_t tcp_new_port(void);//生成新的tcp本地端口
/**
* Called periodically to dispatch TCP timers.
@@ -180,22 +180,22 @@ tcp_close_shutdown(struct tcp_pcb *pcb, u8_t rst_on_unacked_data)
* or for a pcb that has been used and then entered the CLOSED state
* is erroneous, but this should never happen as the pcb has in those cases
* been freed, and so any remaining handles are bogus. */
- /*【・_・?】
- *【・_・?】
- *【・_・?】
- *【・_・?】
+ /*在CLOSED状态下关闭一个pcb似乎是错误的,
+ *尽管如此,一旦在这个状态下分配了而且还没有使用,用户需要一些办法来释放它
+ *调用一个已经被关闭的pcb的tcp_close(),(即2次)或者一个已经被使用了之后,进入CLOSE状态是错误的
+ *但在这些情况下被释放的pcb是不会存在的,因此,任何剩余的句柄都是假的
*/
- err = ERR_OK;//【・_・?】
+ err = ERR_OK;//设定返回值
if (pcb->local_port != 0) {
TCP_RMV(&tcp_bound_pcbs, pcb);
}
- memp_free(MEMP_TCP_PCB, pcb);//【・_・?】
+ memp_free(MEMP_TCP_PCB, pcb);//在MEMP_TCP_PCB内存池设定释放掉的pcb对应的单元值,释放内存
pcb = NULL;
break;
case LISTEN:
err = ERR_OK;
- tcp_pcb_remove(&tcp_listen_pcbs.pcbs, pcb);//【・_・?】
- memp_free(MEMP_TCP_PCB_LISTEN, pcb);//【・_・?】
+ tcp_pcb_remove(&tcp_listen_pcbs.pcbs, pcb);//从监听的PCB列表中删除对应的pcb
+ memp_free(MEMP_TCP_PCB_LISTEN, pcb);//在MEMP_TCP_PCB_LISTEN内存池中设定释放的pcb单元值 ,释放内存
pcb = NULL;
break;
case SYN_SENT:
...
Statistics: Posted by yssz — Wed Sep 07, 2016 9:09 pm
Statistics: Posted by yssz — Wed Sep 07, 2016 12:15 am