aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/daemon.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-03-10 16:29:58 +0100
committerChristian Grothoff <christian@grothoff.org>2017-03-10 16:29:58 +0100
commit4deb335de8af6cc943ca7fc20a69167d8845cd9b (patch)
treef987a9b8744610d7c39657de8656457eebacb237 /src/microhttpd/daemon.c
parent667a974ca7b8ad4ddc72a3feec6c005defd615dd (diff)
downloadlibmicrohttpd-4deb335de8af6cc943ca7fc20a69167d8845cd9b.tar.gz
libmicrohttpd-4deb335de8af6cc943ca7fc20a69167d8845cd9b.zip
avoid redundant NULL check, make MHD_cleanup_upgraded_connection_ static (only used from within daemon.c) and rename to cleanup_upgraded_connection
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r--src/microhttpd/daemon.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 3499f211..9dd2f1cd 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1121,11 +1121,13 @@ call_handlers (struct MHD_Connection *con,
1121 * 1121 *
1122 * @param connection handle to the upgraded connection to clean 1122 * @param connection handle to the upgraded connection to clean
1123 */ 1123 */
1124void 1124static void
1125MHD_cleanup_upgraded_connection_ (struct MHD_Connection *connection) 1125cleanup_upgraded_connection (struct MHD_Connection *connection)
1126{ 1126{
1127 struct MHD_UpgradeResponseHandle *urh = connection->urh; 1127 struct MHD_UpgradeResponseHandle *urh = connection->urh;
1128 1128
1129 if (NULL == urh)
1130 return;
1129#ifdef HTTPS_SUPPORT 1131#ifdef HTTPS_SUPPORT
1130 /* Signal remote client the end of TLS connection by 1132 /* Signal remote client the end of TLS connection by
1131 * gracefully closing TLS session. */ 1133 * gracefully closing TLS session. */
@@ -1139,13 +1141,12 @@ MHD_cleanup_upgraded_connection_ (struct MHD_Connection *connection)
1139 if (MHD_INVALID_SOCKET != urh->app.socket) 1141 if (MHD_INVALID_SOCKET != urh->app.socket)
1140 MHD_socket_close_chk_ (urh->app.socket); 1142 MHD_socket_close_chk_ (urh->app.socket);
1141#endif /* HTTPS_SUPPORT */ 1143#endif /* HTTPS_SUPPORT */
1142
1143 connection->urh = NULL; 1144 connection->urh = NULL;
1144 if (NULL != urh) 1145 free (urh);
1145 free (urh);
1146} 1146}
1147#endif /* UPGRADE_SUPPORT */ 1147#endif /* UPGRADE_SUPPORT */
1148 1148
1149
1149#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) 1150#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
1150/** 1151/**
1151 * Performs bi-directional forwarding on upgraded HTTPS connections 1152 * Performs bi-directional forwarding on upgraded HTTPS connections
@@ -2982,8 +2983,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
2982 (! MHD_join_thread_ (pos->pid)) ) 2983 (! MHD_join_thread_ (pos->pid)) )
2983 MHD_PANIC (_("Failed to join a thread\n")); 2984 MHD_PANIC (_("Failed to join a thread\n"));
2984#ifdef UPGRADE_SUPPORT 2985#ifdef UPGRADE_SUPPORT
2985 if (NULL != pos->urh) 2986 cleanup_upgraded_connection (pos);
2986 MHD_cleanup_upgraded_connection_ (pos);
2987#endif /* UPGRADE_SUPPORT */ 2987#endif /* UPGRADE_SUPPORT */
2988 MHD_pool_destroy (pos->pool); 2988 MHD_pool_destroy (pos->pool);
2989#ifdef HTTPS_SUPPORT 2989#ifdef HTTPS_SUPPORT