Commit 9e625f7e authored by Kenton Varda's avatar Kenton Varda

Add getsockname() to ConnectionReceiver.

This is a no-brainer given AsyncIoStream has getsockopt() and getsockname(), whereas ConnectionReceiver has only getsockopt().
parent 0d7c955b
...@@ -1135,6 +1135,11 @@ public: ...@@ -1135,6 +1135,11 @@ public:
void setsockopt(int level, int option, const void* value, uint length) override { void setsockopt(int level, int option, const void* value, uint length) override {
KJ_SYSCALL(::setsockopt(fd, level, option, value, length)); 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;
}
public: public:
UnixEventPort& eventPort; UnixEventPort& eventPort;
......
...@@ -955,6 +955,11 @@ public: ...@@ -955,6 +955,11 @@ public:
KJ_WINSOCK(::setsockopt(fd, level, option, KJ_WINSOCK(::setsockopt(fd, level, option,
reinterpret_cast<const char*>(value), length)); reinterpret_cast<const char*>(value), length));
} }
void getsockname(struct sockaddr* addr, uint* length) override {
socklen_t socklen = *length;
KJ_WINSOCK(::getsockname(fd, addr, &socklen));
*length = socklen;
}
public: public:
Win32EventPort& eventPort; Win32EventPort& eventPort;
......
...@@ -1939,6 +1939,9 @@ void ConnectionReceiver::getsockopt(int level, int option, void* value, uint* le ...@@ -1939,6 +1939,9 @@ void ConnectionReceiver::getsockopt(int level, int option, void* value, uint* le
void ConnectionReceiver::setsockopt(int level, int option, const void* value, uint length) { void ConnectionReceiver::setsockopt(int level, int option, const void* value, uint length) {
KJ_UNIMPLEMENTED("Not a socket."); KJ_UNIMPLEMENTED("Not a socket.");
} }
void ConnectionReceiver::getsockname(struct sockaddr* addr, uint* length) {
KJ_UNIMPLEMENTED("Not a socket.");
}
void DatagramPort::getsockopt(int level, int option, void* value, uint* length) { void DatagramPort::getsockopt(int level, int option, void* value, uint* length) {
KJ_UNIMPLEMENTED("Not a socket."); KJ_UNIMPLEMENTED("Not a socket.");
} }
......
...@@ -295,6 +295,7 @@ public: ...@@ -295,6 +295,7 @@ public:
virtual void getsockopt(int level, int option, void* value, uint* length); virtual void getsockopt(int level, int option, void* value, uint* length);
virtual void setsockopt(int level, int option, const void* value, uint length); virtual void setsockopt(int level, int option, const void* value, uint length);
virtual void getsockname(struct sockaddr* addr, uint* length);
// Same as the methods of AsyncIoStream. // Same as the methods of AsyncIoStream.
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment