Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
28143f86
Commit
28143f86
authored
Sep 15, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/curl: merge _request_abort() into _request_done()
This is a trivial function. Merge some duplicate code, e.g. the g_cond_broadcast() call.
parent
76ec3d32
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
27 deletions
+15
-27
curl_input_plugin.c
src/input/curl_input_plugin.c
+15
-27
No files found.
src/input/curl_input_plugin.c
View file @
28143f86
...
...
@@ -413,25 +413,6 @@ input_curl_easy_free_indirect(struct input_curl *c)
}
/**
* Aborts and frees a running HTTP request.
*
* The caller must lock the mutex. Runs in the I/O thread.
*/
static
void
input_curl_request_abort
(
struct
input_curl
*
c
,
GError
*
error
)
{
assert
(
c
!=
NULL
);
assert
(
c
->
postponed_error
==
NULL
);
assert
(
error
!=
NULL
);
input_curl_easy_free
(
c
);
c
->
postponed_error
=
error
;
g_cond_broadcast
(
curl
.
cond
);
}
/**
* Abort and free all HTTP requests.
*
* The caller must lock the mutex. Runs in the I/O thread.
...
...
@@ -439,12 +420,19 @@ input_curl_request_abort(struct input_curl *c, GError *error)
static
void
input_curl_abort_all_requests
(
GError
*
error
)
{
assert
(
error
!=
NULL
);
while
(
curl
.
requests
!=
NULL
)
{
struct
input_curl
*
is
=
curl
.
requests
->
data
;
input_curl_request_abort
(
is
,
g_error_copy
(
error
));
struct
input_curl
*
c
=
curl
.
requests
->
data
;
assert
(
c
->
postponed_error
==
NULL
);
input_curl_easy_free
(
c
);
c
->
postponed_error
=
g_error_copy
(
error
);
}
g_error_free
(
error
);
g_cond_broadcast
(
curl
.
cond
);
}
/**
...
...
@@ -455,22 +443,22 @@ input_curl_abort_all_requests(GError *error)
static
void
input_curl_request_done
(
struct
input_curl
*
c
,
CURLcode
result
,
long
status
)
{
assert
(
c
!=
NULL
);
assert
(
c
->
easy
==
NULL
);
assert
(
c
->
base
.
ready
);
assert
(
c
->
postponed_error
==
NULL
);
if
(
result
!=
CURLE_OK
)
{
GError
*
error
=
g_error_new
(
curl_quark
(),
result
,
c
->
postponed_
error
=
g_error_new
(
curl_quark
(),
result
,
"curl failed: %s"
,
c
->
error
);
input_curl_request_abort
(
c
,
error
);
}
else
if
(
status
<
200
||
status
>=
300
)
{
GError
*
error
=
g_error_new
(
curl_quark
(),
0
,
c
->
postponed_
error
=
g_error_new
(
curl_quark
(),
0
,
"got HTTP status %ld"
,
status
);
input_curl_request_abort
(
c
,
error
);
}
else
{
g_cond_broadcast
(
curl
.
cond
);
}
g_cond_broadcast
(
curl
.
cond
);
}
static
void
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment