Skip to content

Commit

Permalink
net/SocketDescriptor: SO_PROTOCOL is really Linux-specific
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Dec 9, 2023
1 parent c95e5b1 commit 753afef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/net/SocketDescriptor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ SocketDescriptor::IsStream() const noexcept
return GetType() == SOCK_STREAM;
}

#ifndef _WIN32
#ifdef __linux__

int
SocketDescriptor::GetProtocol() const noexcept
{
return GetIntOption(SOL_SOCKET, SO_PROTOCOL, -1);
}

#endif // !_WIN32
#endif // __linux__

#ifdef _WIN32

Expand Down
4 changes: 2 additions & 2 deletions src/net/SocketDescriptor.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ public:
[[gnu::pure]]
bool IsStream() const noexcept;

#ifndef _WIN32
#ifdef __linux__
/**
* Determine the socket protocol (SO_PROTOCOL),
* e.g. IPPROTO_SCTP. Returns -1 on error.
*/
[[gnu::pure]]
int GetProtocol() const noexcept;
#endif // !_WIN32
#endif // __linux__

static constexpr SocketDescriptor Undefined() noexcept {
#ifdef _WIN32
Expand Down

0 comments on commit 753afef

Please sign in to comment.