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
01655809
Commit
01655809
authored
Oct 11, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/curl: moved code to fill_buffer()
parent
d6d4de11
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
27 deletions
+40
-27
curl_input_plugin.c
src/input/curl_input_plugin.c
+40
-27
No files found.
src/input/curl_input_plugin.c
View file @
01655809
...
...
@@ -282,6 +282,42 @@ input_curl_select(struct input_curl *c)
return
ret
;
}
static
bool
fill_buffer
(
struct
input_stream
*
is
)
{
struct
input_curl
*
c
=
is
->
data
;
CURLMcode
mcode
=
CURLM_CALL_MULTI_PERFORM
;
while
(
!
c
->
eof
&&
g_queue_is_empty
(
c
->
buffers
))
{
int
running_handles
;
bool
bret
;
if
(
mcode
!=
CURLM_CALL_MULTI_PERFORM
)
{
/* if we're still here, there is no input yet
- wait for input */
int
ret
=
input_curl_select
(
c
);
if
(
ret
<=
0
)
/* no data yet or error */
return
false
;
}
mcode
=
curl_multi_perform
(
c
->
multi
,
&
running_handles
);
if
(
mcode
!=
CURLM_OK
&&
mcode
!=
CURLM_CALL_MULTI_PERFORM
)
{
g_warning
(
"curl_multi_perform() failed: %s
\n
"
,
curl_multi_strerror
(
mcode
));
c
->
eof
=
true
;
is
->
ready
=
true
;
return
false
;
}
bret
=
input_curl_multi_info_read
(
is
);
if
(
!
bret
)
return
false
;
}
return
true
;
}
/**
* Mark a part of the buffer object as consumed.
*/
...
...
@@ -381,7 +417,7 @@ static size_t
input_curl_read
(
struct
input_stream
*
is
,
void
*
ptr
,
size_t
size
)
{
struct
input_curl
*
c
=
is
->
data
;
CURLMcode
mcode
=
CURLM_CALL_MULTI_PERFORM
;
bool
success
;
GQueue
*
rewind_buffers
;
size_t
nbytes
=
0
;
char
*
dest
=
ptr
;
...
...
@@ -409,32 +445,9 @@ input_curl_read(struct input_stream *is, void *ptr, size_t size)
/* fill the buffer */
while
(
!
c
->
eof
&&
g_queue_is_empty
(
c
->
buffers
))
{
int
running_handles
;
bool
bret
;
if
(
mcode
!=
CURLM_CALL_MULTI_PERFORM
)
{
/* if we're still here, there is no input yet
- wait for input */
int
ret
=
input_curl_select
(
c
);
if
(
ret
<=
0
)
/* no data yet or error */
return
0
;
}
mcode
=
curl_multi_perform
(
c
->
multi
,
&
running_handles
);
if
(
mcode
!=
CURLM_OK
&&
mcode
!=
CURLM_CALL_MULTI_PERFORM
)
{
g_warning
(
"curl_multi_perform() failed: %s
\n
"
,
curl_multi_strerror
(
mcode
));
c
->
eof
=
true
;
is
->
ready
=
true
;
return
0
;
}
bret
=
input_curl_multi_info_read
(
is
);
if
(
!
bret
)
return
0
;
}
success
=
fill_buffer
(
is
);
if
(
!
success
)
return
0
;
/* send buffer contents */
...
...
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