فهرست منبع

remove bogus NULL check (this function must never be called with a NULL argument), rename as it is not static

Christian Grothoff 9 سال پیش
والد
کامیت
71806e71a6
3فایلهای تغییر یافته به همراه11 افزوده شده و 10 حذف شده
  1. 8 8
      src/microhttpd/daemon.c
  2. 2 1
      src/microhttpd/internal.h
  3. 1 1
      src/microhttpd/response.c

+ 8 - 8
src/microhttpd/daemon.c

@@ -916,16 +916,15 @@ call_handlers (struct MHD_Connection *con,
  * Finally cleanup upgrade-related resources. It should
  * be called when TLS buffers have been drained and
  * application signaled MHD by #MHD_UPGRADE_ACTION_CLOSE.
+ *
  * @param connection handle to the upgraded connection to clean
  */
 void
-cleanup_upgraded_connection (struct MHD_Connection *connection)
+MHD_cleanup_upgraded_connection_ (struct MHD_Connection *connection)
 {
-  struct MHD_Daemon *daemon;
+  struct MHD_Daemon *daemon = connection->daemon;
   struct MHD_UpgradeResponseHandle *urh;
-  if (NULL == connection)
-    return;
-  daemon = connection->daemon;
+
   urh = connection->urh;
   if (NULL == urh)
     return;
@@ -1267,7 +1266,7 @@ thread_main_connection_upgrade (struct MHD_Connection *con)
   MHD_semaphore_down (con->upgrade_sem);
   MHD_semaphore_destroy (con->upgrade_sem);
   con->upgrade_sem = NULL;
-  cleanup_upgraded_connection(con);
+  MHD_cleanup_upgraded_connection_ (con);
 }
 
 
@@ -2785,8 +2784,9 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
       /* call generic forwarding function for passing data */
       process_urh (urh);
       /* cleanup connection if it was closed and all data was sent */
-      if (MHD_YES == urh->was_closed && 0 == urh->out_buffer_off)
-        cleanup_upgraded_connection (urh->connection);
+      if ( (MHD_YES == urh->was_closed) &&
+           (0 == urh->out_buffer_off) )
+        MHD_cleanup_upgraded_connection_ (urh->connection);
     }
 #endif
   MHD_cleanup_connections (daemon);

+ 2 - 1
src/microhttpd/internal.h

@@ -1727,9 +1727,10 @@ MHD_parse_arguments_ (struct MHD_Connection *connection,
  * Finally cleanup upgrade-related resources. It should
  * be called when TLS buffers have been drained and
  * application signaled MHD by #MHD_UPGRADE_ACTION_CLOSE.
+ *
  * @param connection handle to the upgraded connection to clean
  */
 void
-cleanup_upgraded_connection (struct MHD_Connection *connection);
+MHD_cleanup_upgraded_connection_ (struct MHD_Connection *connection);
 
 #endif

+ 1 - 1
src/microhttpd/response.c

@@ -660,7 +660,7 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
       }
 #endif
     /* 'upgraded' resources are not needed anymore - cleanup now */
-    cleanup_upgraded_connection (connection);
+    MHD_cleanup_upgraded_connection_ (connection);
     return MHD_YES;
   default:
     /* we don't understand this one */