⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 patches.txt

📁 picoos源码。The RTOS and the TCP/IP stack will be built automatically.
💻 TXT
字号:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'                                                         '
'  This file contains some patches from me that fix some  '
'  small bugs in lwip 1.1.1.                              '
'                                                         '
'  Please apply the patches with the command              '
'  "patch -i patches.txt".                                '
'                                                         '
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--- lwip-1.1.1/src/api/api_lib.c	Fri Nov 25 11:03:38 2005
+++ lwip-1.1.1/src/api/api_lib.c	Fri Apr 14 10:49:12 2006
@@ -621,7 +621,8 @@
 netconn_write(struct netconn *conn, void *dataptr, u16_t size, u8_t copy)
 {
   struct api_msg *msg;
-  u16_t len;
+  u16_t len, sndbuf;
+  sys_sem_t sem;
   
   if (conn == NULL) {
     return ERR_VAL;
@@ -651,16 +652,16 @@
     msg->msg.msg.w.copy = copy;
     
     if (conn->type == NETCONN_TCP) {
-      if (tcp_sndbuf(conn->pcb.tcp) == 0) {
+      while ((sndbuf = tcp_sndbuf(conn->pcb.tcp)) == 0) {
   sys_sem_wait(conn->sem);
   if (conn->err != ERR_OK) {
     goto ret;
   }
       }
-      if (size > tcp_sndbuf(conn->pcb.tcp)) {
+      if (size > sndbuf) {
   /* We cannot send more than one send buffer's worth of data at a
      time. */
-  len = tcp_sndbuf(conn->pcb.tcp);
+  len = sndbuf;
       } else {
   len = size;
       }
@@ -685,9 +686,9 @@
  ret:
   memp_free(MEMP_API_MSG, msg);
   conn->state = NETCONN_NONE;
-  if (conn->sem != SYS_SEM_NULL) {
-    sys_sem_free(conn->sem);
+  if ((sem = conn->sem) != SYS_SEM_NULL) {
     conn->sem = SYS_SEM_NULL;
+    sys_sem_free(sem);
   }
   
   return conn->err;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -