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
1e3089ff
Commit
1e3089ff
authored
Dec 11, 2020
by
Max Kellermann
Committed by
Max Kellermann
Dec 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
curl/Request: move struct Pause to class CurlResponseHandler
parent
5d7ff150
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
8 deletions
+11
-8
CurlInputPlugin.cxx
src/input/plugins/CurlInputPlugin.cxx
+1
-1
Handler.hxx
src/lib/curl/Handler.hxx
+9
-0
Request.cxx
src/lib/curl/Request.cxx
+1
-1
Request.hxx
src/lib/curl/Request.hxx
+0
-6
No files found.
src/input/plugins/CurlInputPlugin.cxx
View file @
1e3089ff
...
...
@@ -309,7 +309,7 @@ CurlInputStream::OnData(ConstBuffer<void> data)
if
(
data
.
size
>
GetBufferSpace
())
{
AsyncInputStream
::
Pause
();
throw
CurlRe
quest
::
Pause
()
;
throw
CurlRe
sponseHandler
::
Pause
{}
;
}
AppendToBuffer
(
data
.
data
,
data
.
size
);
...
...
src/lib/curl/Handler.hxx
View file @
1e3089ff
...
...
@@ -44,6 +44,13 @@
class
CurlResponseHandler
{
public
:
/**
* OnData() shall throw this to pause the stream. Call
* CurlEasy::Unpause() or CurlRequest::Resume() to resume the
* transfer.
*/
struct
Pause
{};
/**
* Status line and headers have been received.
*/
virtual
void
OnHeaders
(
unsigned
status
,
...
...
@@ -51,6 +58,8 @@ public:
/**
* Response body data has been received.
*
* May throw #Pause.
*/
virtual
void
OnData
(
ConstBuffer
<
void
>
data
)
=
0
;
...
...
src/lib/curl/Request.cxx
View file @
1e3089ff
...
...
@@ -241,7 +241,7 @@ CurlRequest::DataReceived(const void *ptr, size_t received_size) noexcept
FinishHeaders
();
handler
.
OnData
({
ptr
,
received_size
});
return
received_size
;
}
catch
(
Pause
)
{
}
catch
(
CurlResponseHandler
::
Pause
)
{
return
CURL_WRITEFUNC_PAUSE
;
}
catch
(...)
{
state
=
State
::
CLOSED
;
...
...
src/lib/curl/Request.hxx
View file @
1e3089ff
...
...
@@ -146,12 +146,6 @@ public:
easy
.
SetRequestBody
(
data
,
size
);
}
/**
* CurlResponseHandler::OnData() shall throw this to pause the
* stream. Call Resume() to resume the transfer.
*/
struct
Pause
{};
void
Resume
()
noexcept
;
/**
...
...
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