From 5028845cdf4c7f6eeb1a0e28aeed744d38760989 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Sun, 4 Mar 2018 12:43:51 +0200 Subject: [PATCH] http: warn if pending requests exist at shutdown Commit e7ea3323acb7c3ba5af7c78fc77818ecde65805d fixed an API violation in the code. Add a warning in the debug log to make these cases less likely to happen in the future. (cherry picked from commit 0f553d195669e5beb0e9d61d7d801707ebb177cb) --- src/core/sipe-http-request.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/core/sipe-http-request.c b/src/core/sipe-http-request.c index 292ec261..8a688c2e 100644 --- a/src/core/sipe-http-request.c +++ b/src/core/sipe-http-request.c @@ -3,7 +3,7 @@ * * pidgin-sipe * - * Copyright (C) 2013-2016 SIPE Project + * Copyright (C) 2013-2018 SIPE Project * * * This program is free software; you can redistribute it and/or modify @@ -522,12 +522,28 @@ void sipe_http_request_shutdown(struct sipe_http_connection_public *conn_public, { if (conn_public->pending_requests) { GSList *entry = conn_public->pending_requests; + guint status = abort ? + SIPE_HTTP_STATUS_ABORTED : + SIPE_HTTP_STATUS_FAILED; + gboolean warn = conn_public->connected && !abort; while (entry) { + struct sipe_http_request *req = entry->data; + + if (warn) { + SIPE_DEBUG_ERROR("sipe_http_request_shutdown: pending request at shutdown: could indicate missing _ready() call on request. Debugging information:\n" + "Host: %s\n" + "Port: %d\n" + "Path: %s\n" + "Method: %s\n", + conn_public->host, + conn_public->port, + req->path, + req->body ? "POST" : "GET"); + } + sipe_http_request_free(conn_public->sipe_private, - entry->data, - abort ? - SIPE_HTTP_STATUS_ABORTED : - SIPE_HTTP_STATUS_FAILED); + req, + status); entry = entry->next; } g_slist_free(conn_public->pending_requests); -- 2.11.4.GIT