summaryrefslogtreecommitdiff
path: root/tests/connection-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/connection-test.c')
-rw-r--r--tests/connection-test.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/connection-test.c b/tests/connection-test.c
index 545bf101..7c6fb5a0 100644
--- a/tests/connection-test.c
+++ b/tests/connection-test.c
@@ -23,11 +23,20 @@ static void
close_socket (SoupMessage *msg, gpointer user_data)
{
SoupSocket *sock = user_data;
+ int sockfd;
- soup_socket_disconnect (sock);
-
- /* But also add the missing data to the message now, so
- * SoupServer can clean up after itself properly.
+ /* Actually calling soup_socket_disconnect() here would cause
+ * us to leak memory, so just shutdown the socket instead.
+ */
+ sockfd = soup_socket_get_fd (sock);
+#ifdef G_OS_WIN32
+ shutdown (sockfd, SD_SEND);
+#else
+ shutdown (sockfd, SHUT_WR);
+#endif
+
+ /* Then add the missing data to the message now, so SoupServer
+ * can clean up after itself properly.
*/
soup_message_body_append (msg->response_body, SOUP_MEMORY_STATIC,
"foo", 3);