Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
628559ad
Commit
628559ad
authored
Feb 19, 2015
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add getsockname() and getpeername() methods to AsyncIoStream.
parent
c9332ebe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
async-io.c++
c++/src/kj/async-io.c++
+18
-0
async-io.h
c++/src/kj/async-io.h
+12
-0
No files found.
c++/src/kj/async-io.c++
View file @
628559ad
...
...
@@ -190,6 +190,18 @@ public:
KJ_SYSCALL
(
::
setsockopt
(
fd
,
level
,
option
,
value
,
length
));
}
void
getsockname
(
struct
sockaddr
*
addr
,
uint
*
length
)
override
{
socklen_t
socklen
=
*
length
;
KJ_SYSCALL
(
::
getsockname
(
fd
,
addr
,
&
socklen
));
*
length
=
socklen
;
}
void
getpeername
(
struct
sockaddr
*
addr
,
uint
*
length
)
override
{
socklen_t
socklen
=
*
length
;
KJ_SYSCALL
(
::
getpeername
(
fd
,
addr
,
&
socklen
));
*
length
=
socklen
;
}
Promise
<
void
>
waitConnected
()
{
// Wait until initial connection has completed. This actually just waits until it is writable.
...
...
@@ -1329,6 +1341,12 @@ void AsyncIoStream::getsockopt(int level, int option, void* value, uint* length)
void
AsyncIoStream
::
setsockopt
(
int
level
,
int
option
,
const
void
*
value
,
uint
length
)
{
KJ_UNIMPLEMENTED
(
"Not a socket."
);
}
void
AsyncIoStream
::
getsockname
(
struct
sockaddr
*
addr
,
uint
*
length
)
{
KJ_UNIMPLEMENTED
(
"Not a socket."
);
}
void
AsyncIoStream
::
getpeername
(
struct
sockaddr
*
addr
,
uint
*
length
)
{
KJ_UNIMPLEMENTED
(
"Not a socket."
);
}
void
ConnectionReceiver
::
getsockopt
(
int
level
,
int
option
,
void
*
value
,
uint
*
length
)
{
KJ_UNIMPLEMENTED
(
"Not a socket."
);
}
...
...
c++/src/kj/async-io.h
View file @
628559ad
...
...
@@ -31,6 +31,8 @@
#include "thread.h"
#include "time.h"
struct
sockaddr
;
namespace
kj
{
class
UnixEventPort
;
...
...
@@ -69,6 +71,16 @@ public:
// Corresponds to getsockopt() and setsockopt() syscalls. Will throw an "unimplemented" exception
// if the stream is not a socket or the option is not appropriate for the socket type. The
// default implementations always throw "unimplemented".
virtual
void
getsockname
(
struct
sockaddr
*
addr
,
uint
*
length
);
virtual
void
getpeername
(
struct
sockaddr
*
addr
,
uint
*
length
);
// Corresponds to getsockname() and getpeername() syscalls. Will throw an "unimplemented"
// exception if the stream is not a socket. The default implementations always throw
// "unimplemented".
//
// Note that we don't provide methods that return NetworkAddress because it usually wouldn't
// be useful. You can't connect() to or listen() on these addresses, obviously, because they are
// ephemeral addresses for a single connection.
};
struct
OneWayPipe
{
...
...
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