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
9f02beab
Commit
9f02beab
authored
Aug 19, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/curl: fix coding style
parent
a478af67
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
21 deletions
+22
-21
Global.cxx
src/lib/curl/Global.cxx
+19
-18
Global.hxx
src/lib/curl/Global.hxx
+2
-2
Slist.hxx
src/lib/curl/Slist.hxx
+1
-1
No files found.
src/lib/curl/Global.cxx
View file @
9f02beab
...
@@ -48,7 +48,7 @@ public:
...
@@ -48,7 +48,7 @@ public:
CurlSocket
(
CurlGlobal
&
_global
,
EventLoop
&
_loop
,
SocketDescriptor
_fd
)
CurlSocket
(
CurlGlobal
&
_global
,
EventLoop
&
_loop
,
SocketDescriptor
_fd
)
:
SocketMonitor
(
_fd
,
_loop
),
global
(
_global
)
{}
:
SocketMonitor
(
_fd
,
_loop
),
global
(
_global
)
{}
~
CurlSocket
()
{
~
CurlSocket
()
noexcept
{
/* TODO: sometimes, CURL uses CURL_POLL_REMOVE after
/* TODO: sometimes, CURL uses CURL_POLL_REMOVE after
closing the socket, and sometimes, it uses
closing the socket, and sometimes, it uses
CURL_POLL_REMOVE just to move the (still open)
CURL_POLL_REMOVE just to move the (still open)
...
@@ -109,7 +109,8 @@ CurlGlobal::CurlGlobal(EventLoop &_loop)
...
@@ -109,7 +109,8 @@ CurlGlobal::CurlGlobal(EventLoop &_loop)
int
int
CurlSocket
::
SocketFunction
(
gcc_unused
CURL
*
easy
,
CurlSocket
::
SocketFunction
(
gcc_unused
CURL
*
easy
,
curl_socket_t
s
,
int
action
,
curl_socket_t
s
,
int
action
,
void
*
userp
,
void
*
socketp
)
noexcept
{
void
*
userp
,
void
*
socketp
)
noexcept
{
auto
&
global
=
*
(
CurlGlobal
*
)
userp
;
auto
&
global
=
*
(
CurlGlobal
*
)
userp
;
CurlSocket
*
cs
=
(
CurlSocket
*
)
socketp
;
CurlSocket
*
cs
=
(
CurlSocket
*
)
socketp
;
...
@@ -219,6 +220,20 @@ CurlGlobal::ReadInfo() noexcept
...
@@ -219,6 +220,20 @@ CurlGlobal::ReadInfo() noexcept
}
}
}
}
void
CurlGlobal
::
SocketAction
(
curl_socket_t
fd
,
int
ev_bitmask
)
noexcept
{
int
running_handles
;
CURLMcode
mcode
=
curl_multi_socket_action
(
multi
.
Get
(),
fd
,
ev_bitmask
,
&
running_handles
);
if
(
mcode
!=
CURLM_OK
)
FormatError
(
curlm_domain
,
"curl_multi_socket_action() failed: %s"
,
curl_multi_strerror
(
mcode
));
defer_read_info
.
Schedule
();
}
inline
void
inline
void
CurlGlobal
::
UpdateTimeout
(
long
timeout_ms
)
noexcept
CurlGlobal
::
UpdateTimeout
(
long
timeout_ms
)
noexcept
{
{
...
@@ -238,11 +253,11 @@ CurlGlobal::UpdateTimeout(long timeout_ms) noexcept
...
@@ -238,11 +253,11 @@ CurlGlobal::UpdateTimeout(long timeout_ms) noexcept
}
}
int
int
CurlGlobal
::
TimerFunction
(
gcc_unused
CURLM
*
_
global
,
long
timeout_ms
,
CurlGlobal
::
TimerFunction
(
gcc_unused
CURLM
*
_
multi
,
long
timeout_ms
,
void
*
userp
)
noexcept
void
*
userp
)
noexcept
{
{
auto
&
global
=
*
(
CurlGlobal
*
)
userp
;
auto
&
global
=
*
(
CurlGlobal
*
)
userp
;
assert
(
_
global
==
global
.
multi
.
Get
());
assert
(
_
multi
==
global
.
multi
.
Get
());
global
.
UpdateTimeout
(
timeout_ms
);
global
.
UpdateTimeout
(
timeout_ms
);
return
0
;
return
0
;
...
@@ -253,17 +268,3 @@ CurlGlobal::OnTimeout() noexcept
...
@@ -253,17 +268,3 @@ CurlGlobal::OnTimeout() noexcept
{
{
SocketAction
(
CURL_SOCKET_TIMEOUT
,
0
);
SocketAction
(
CURL_SOCKET_TIMEOUT
,
0
);
}
}
void
CurlGlobal
::
SocketAction
(
curl_socket_t
fd
,
int
ev_bitmask
)
noexcept
{
int
running_handles
;
CURLMcode
mcode
=
curl_multi_socket_action
(
multi
.
Get
(),
fd
,
ev_bitmask
,
&
running_handles
);
if
(
mcode
!=
CURLM_OK
)
FormatError
(
curlm_domain
,
"curl_multi_socket_action() failed: %s"
,
curl_multi_strerror
(
mcode
));
defer_read_info
.
Schedule
();
}
src/lib/curl/Global.hxx
View file @
9f02beab
...
@@ -70,7 +70,7 @@ public:
...
@@ -70,7 +70,7 @@ public:
void
SocketAction
(
curl_socket_t
fd
,
int
ev_bitmask
)
noexcept
;
void
SocketAction
(
curl_socket_t
fd
,
int
ev_bitmask
)
noexcept
;
void
InvalidateSockets
()
{
void
InvalidateSockets
()
noexcept
{
SocketAction
(
CURL_SOCKET_TIMEOUT
,
0
);
SocketAction
(
CURL_SOCKET_TIMEOUT
,
0
);
}
}
...
@@ -86,7 +86,7 @@ public:
...
@@ -86,7 +86,7 @@ public:
private
:
private
:
void
UpdateTimeout
(
long
timeout_ms
)
noexcept
;
void
UpdateTimeout
(
long
timeout_ms
)
noexcept
;
static
int
TimerFunction
(
CURLM
*
global
,
long
timeout_ms
,
static
int
TimerFunction
(
CURLM
*
multi
,
long
timeout_ms
,
void
*
userp
)
noexcept
;
void
*
userp
)
noexcept
;
/* callback for #timeout_event */
/* callback for #timeout_event */
...
...
src/lib/curl/Slist.hxx
View file @
9f02beab
...
@@ -41,7 +41,7 @@ class CurlSlist {
...
@@ -41,7 +41,7 @@ class CurlSlist {
struct
curl_slist
*
head
=
nullptr
;
struct
curl_slist
*
head
=
nullptr
;
public
:
public
:
CurlSlist
()
=
default
;
CurlSlist
()
noexcept
=
default
;
CurlSlist
(
CurlSlist
&&
src
)
noexcept
CurlSlist
(
CurlSlist
&&
src
)
noexcept
:
head
(
std
::
exchange
(
src
.
head
,
nullptr
))
{}
:
head
(
std
::
exchange
(
src
.
head
,
nullptr
))
{}
...
...
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