diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-07-14 17:59:09 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-07-14 17:59:09 +0000 |
commit | 282386193c63b9c02d7e7201d06b7fc19c2708d4 (patch) | |
tree | 2b3e7e42168db5f1f5c63baa87d82c57e29b53dd | |
parent | 326441639c0b3eb3c84d1b3368e1e12b4aba75e7 (diff) | |
download | libmicrohttpd-282386193c63b9c02d7e7201d06b7fc19c2708d4.tar.gz libmicrohttpd-282386193c63b9c02d7e7201d06b7fc19c2708d4.zip |
eliminate shutdown calls that are not required, strictly speaking
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/microhttpd/connection.c | 4 | ||||
-rw-r--r-- | src/microhttpd/daemon.c | 10 |
3 files changed, 9 insertions, 11 deletions
@@ -1,3 +1,9 @@ | |||
1 | Sun Jul 14 19:57:56 CEST 2013 | ||
2 | Removing 'shutdown' calls that happen just before close or | ||
3 | that are for read-only and for a client that has already | ||
4 | stopped sending anyway (thus reducing number of system calls | ||
5 | slightly). -CG | ||
6 | |||
1 | Sun Jul 14 19:37:37 CEST 2013 | 7 | Sun Jul 14 19:37:37 CEST 2013 |
2 | Name MHD worker threads on glibc >= 2.12. -,L4X[o](B | 8 | Name MHD worker threads on glibc >= 2.12. -,L4X[o](B |
3 | 9 | ||
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 8f2c9bca..a16bf62d 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -1504,7 +1504,9 @@ do_read (struct MHD_Connection *connection) | |||
1504 | { | 1504 | { |
1505 | /* other side closed connection */ | 1505 | /* other side closed connection */ |
1506 | connection->read_closed = MHD_YES; | 1506 | connection->read_closed = MHD_YES; |
1507 | SHUTDOWN (connection->socket_fd, SHUT_RD); | 1507 | /* shutdown is not required here, as the other side already |
1508 | knows; so flagging this internally should suffice */ | ||
1509 | /* SHUTDOWN (connection->socket_fd, SHUT_RD); */ | ||
1508 | return MHD_YES; | 1510 | return MHD_YES; |
1509 | } | 1511 | } |
1510 | connection->read_buffer_offset += bytes_read; | 1512 | connection->read_buffer_offset += bytes_read; |
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index f27f0c83..965f9985 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -1002,7 +1002,6 @@ MHD_add_connection (struct MHD_Daemon *daemon, | |||
1002 | client_socket, | 1002 | client_socket, |
1003 | addr, addrlen); | 1003 | addr, addrlen); |
1004 | /* all pools are at their connection limit, must refuse */ | 1004 | /* all pools are at their connection limit, must refuse */ |
1005 | SHUTDOWN (client_socket, SHUT_RDWR); | ||
1006 | if (0 != CLOSE (client_socket)) | 1005 | if (0 != CLOSE (client_socket)) |
1007 | MHD_PANIC ("close failed\n"); | 1006 | MHD_PANIC ("close failed\n"); |
1008 | return MHD_NO; | 1007 | return MHD_NO; |
@@ -1018,7 +1017,6 @@ MHD_add_connection (struct MHD_Daemon *daemon, | |||
1018 | client_socket, | 1017 | client_socket, |
1019 | FD_SETSIZE); | 1018 | FD_SETSIZE); |
1020 | #endif | 1019 | #endif |
1021 | SHUTDOWN (client_socket, SHUT_RDWR); | ||
1022 | if (0 != CLOSE (client_socket)) | 1020 | if (0 != CLOSE (client_socket)) |
1023 | MHD_PANIC ("close failed\n"); | 1021 | MHD_PANIC ("close failed\n"); |
1024 | return MHD_NO; | 1022 | return MHD_NO; |
@@ -1039,7 +1037,6 @@ MHD_add_connection (struct MHD_Daemon *daemon, | |||
1039 | MHD_DLOG (daemon, | 1037 | MHD_DLOG (daemon, |
1040 | "Server reached connection limit (closing inbound connection)\n"); | 1038 | "Server reached connection limit (closing inbound connection)\n"); |
1041 | #endif | 1039 | #endif |
1042 | SHUTDOWN (client_socket, SHUT_RDWR); | ||
1043 | if (0 != CLOSE (client_socket)) | 1040 | if (0 != CLOSE (client_socket)) |
1044 | MHD_PANIC ("close failed\n"); | 1041 | MHD_PANIC ("close failed\n"); |
1045 | return MHD_NO; | 1042 | return MHD_NO; |
@@ -1055,7 +1052,6 @@ MHD_add_connection (struct MHD_Daemon *daemon, | |||
1055 | MHD_DLOG (daemon, "Connection rejected, closing connection\n"); | 1052 | MHD_DLOG (daemon, "Connection rejected, closing connection\n"); |
1056 | #endif | 1053 | #endif |
1057 | #endif | 1054 | #endif |
1058 | SHUTDOWN (client_socket, SHUT_RDWR); | ||
1059 | if (0 != CLOSE (client_socket)) | 1055 | if (0 != CLOSE (client_socket)) |
1060 | MHD_PANIC ("close failed\n"); | 1056 | MHD_PANIC ("close failed\n"); |
1061 | MHD_ip_limit_del (daemon, addr, addrlen); | 1057 | MHD_ip_limit_del (daemon, addr, addrlen); |
@@ -1079,7 +1075,6 @@ MHD_add_connection (struct MHD_Daemon *daemon, | |||
1079 | "Error allocating memory: %s\n", | 1075 | "Error allocating memory: %s\n", |
1080 | STRERROR (errno)); | 1076 | STRERROR (errno)); |
1081 | #endif | 1077 | #endif |
1082 | SHUTDOWN (client_socket, SHUT_RDWR); | ||
1083 | if (0 != CLOSE (client_socket)) | 1078 | if (0 != CLOSE (client_socket)) |
1084 | MHD_PANIC ("close failed\n"); | 1079 | MHD_PANIC ("close failed\n"); |
1085 | MHD_ip_limit_del (daemon, addr, addrlen); | 1080 | MHD_ip_limit_del (daemon, addr, addrlen); |
@@ -1094,7 +1089,6 @@ MHD_add_connection (struct MHD_Daemon *daemon, | |||
1094 | "Error allocating memory: %s\n", | 1089 | "Error allocating memory: %s\n", |
1095 | STRERROR (errno)); | 1090 | STRERROR (errno)); |
1096 | #endif | 1091 | #endif |
1097 | SHUTDOWN (client_socket, SHUT_RDWR); | ||
1098 | if (0 != CLOSE (client_socket)) | 1092 | if (0 != CLOSE (client_socket)) |
1099 | MHD_PANIC ("close failed\n"); | 1093 | MHD_PANIC ("close failed\n"); |
1100 | MHD_ip_limit_del (daemon, addr, addrlen); | 1094 | MHD_ip_limit_del (daemon, addr, addrlen); |
@@ -1110,7 +1104,6 @@ MHD_add_connection (struct MHD_Daemon *daemon, | |||
1110 | "Error allocating memory: %s\n", | 1104 | "Error allocating memory: %s\n", |
1111 | STRERROR (errno)); | 1105 | STRERROR (errno)); |
1112 | #endif | 1106 | #endif |
1113 | SHUTDOWN (client_socket, SHUT_RDWR); | ||
1114 | if (0 != CLOSE (client_socket)) | 1107 | if (0 != CLOSE (client_socket)) |
1115 | MHD_PANIC ("close failed\n"); | 1108 | MHD_PANIC ("close failed\n"); |
1116 | MHD_ip_limit_del (daemon, addr, addrlen); | 1109 | MHD_ip_limit_del (daemon, addr, addrlen); |
@@ -1184,7 +1177,6 @@ MHD_add_connection (struct MHD_Daemon *daemon, | |||
1184 | "Failed to setup TLS credentials: unknown credential type %d\n", | 1177 | "Failed to setup TLS credentials: unknown credential type %d\n", |
1185 | daemon->cred_type); | 1178 | daemon->cred_type); |
1186 | #endif | 1179 | #endif |
1187 | SHUTDOWN (client_socket, SHUT_RDWR); | ||
1188 | if (0 != CLOSE (client_socket)) | 1180 | if (0 != CLOSE (client_socket)) |
1189 | MHD_PANIC ("close failed\n"); | 1181 | MHD_PANIC ("close failed\n"); |
1190 | MHD_ip_limit_del (daemon, addr, addrlen); | 1182 | MHD_ip_limit_del (daemon, addr, addrlen); |
@@ -1261,7 +1253,6 @@ MHD_add_connection (struct MHD_Daemon *daemon, | |||
1261 | return MHD_YES; | 1253 | return MHD_YES; |
1262 | #if HTTPS_SUPPORT || EPOLL_SUPPORT | 1254 | #if HTTPS_SUPPORT || EPOLL_SUPPORT |
1263 | cleanup: | 1255 | cleanup: |
1264 | SHUTDOWN (client_socket, SHUT_RDWR); | ||
1265 | if (0 != CLOSE (client_socket)) | 1256 | if (0 != CLOSE (client_socket)) |
1266 | MHD_PANIC ("close failed\n"); | 1257 | MHD_PANIC ("close failed\n"); |
1267 | MHD_ip_limit_del (daemon, addr, addrlen); | 1258 | MHD_ip_limit_del (daemon, addr, addrlen); |
@@ -1330,7 +1321,6 @@ MHD_accept_connection (struct MHD_Daemon *daemon) | |||
1330 | #endif | 1321 | #endif |
1331 | if (-1 != s) | 1322 | if (-1 != s) |
1332 | { | 1323 | { |
1333 | SHUTDOWN (s, SHUT_RDWR); | ||
1334 | if (0 != CLOSE (s)) | 1324 | if (0 != CLOSE (s)) |
1335 | MHD_PANIC ("close failed\n"); | 1325 | MHD_PANIC ("close failed\n"); |
1336 | /* just in case */ | 1326 | /* just in case */ |