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
50de3a78
Commit
50de3a78
authored
Jan 28, 2020
by
Max Kellermann
Committed by
Max Kellermann
Feb 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net/AddressInfo: add MakeAddrInfo()
parent
36cad54c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
AddressInfo.hxx
src/net/AddressInfo.hxx
+11
-0
Resolver.cxx
src/net/Resolver.cxx
+1
-5
No files found.
src/net/AddressInfo.hxx
View file @
50de3a78
...
...
@@ -40,6 +40,17 @@
#include <netdb.h>
#endif
constexpr
struct
addrinfo
MakeAddrInfo
(
int
flags
,
int
family
,
int
socktype
,
int
protocol
=
0
)
noexcept
{
struct
addrinfo
ai
{};
ai
.
ai_flags
=
flags
;
ai
.
ai_family
=
family
;
ai
.
ai_socktype
=
socktype
;
ai
.
ai_protocol
=
protocol
;
return
ai
;
}
class
AddressInfo
:
addrinfo
{
/* this class cannot be instantiated, it can only be cast from
a struct addrinfo pointer */
...
...
src/net/Resolver.cxx
View file @
50de3a78
...
...
@@ -149,10 +149,6 @@ Resolve(const char *host_and_port, int default_port,
AddressInfoList
Resolve
(
const
char
*
host_port
,
unsigned
default_port
,
int
flags
,
int
socktype
)
{
struct
addrinfo
hints
{};
hints
.
ai_flags
=
flags
;
hints
.
ai_family
=
AF_UNSPEC
;
hints
.
ai_socktype
=
socktype
;
const
auto
hints
=
MakeAddrInfo
(
flags
,
AF_UNSPEC
,
socktype
);
return
Resolve
(
host_port
,
default_port
,
&
hints
);
}
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