refactor: Make throwError and throwNameError members of IArchNetwork
make throwError and throwNameError noreturn
remove unused extra private section in IArchNetwork subclasses
This commit is contained in:
committed by
Chris Rizzitello
parent
ab4fbd1c85
commit
2421a8b725
@ -274,4 +274,15 @@ public:
|
||||
//@}
|
||||
|
||||
virtual void init() = 0;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief throwError, Used to throw network errors
|
||||
*/
|
||||
[[noreturn]] virtual void throwError(int) const = 0;
|
||||
|
||||
/**
|
||||
* @brief throwNameError, Errors related to client names.
|
||||
*/
|
||||
[[noreturn]] virtual void throwNameError(int) const = 0;
|
||||
};
|
||||
|
||||
@ -742,7 +742,7 @@ const int *ArchNetworkBSD::getUnblockPipeForThread(ArchThread thread)
|
||||
return unblockPipe;
|
||||
}
|
||||
|
||||
void ArchNetworkBSD::throwError(int err) const
|
||||
[[noreturn]] void ArchNetworkBSD::throwError(int err) const
|
||||
{
|
||||
switch (err) {
|
||||
case EINTR:
|
||||
@ -813,7 +813,7 @@ void ArchNetworkBSD::throwError(int err) const
|
||||
}
|
||||
}
|
||||
|
||||
void ArchNetworkBSD::throwNameError(int err) const
|
||||
[[noreturn]] void ArchNetworkBSD::throwNameError(int err) const
|
||||
{
|
||||
static const char *s_msg[] = {
|
||||
"The specified host is unknown", "The requested name is valid but does not have an IP address",
|
||||
|
||||
@ -104,10 +104,9 @@ private:
|
||||
const int *getUnblockPipe();
|
||||
const int *getUnblockPipeForThread(ArchThread);
|
||||
void setBlockingOnSocket(int fd, bool blocking) const;
|
||||
void throwError(int) const;
|
||||
void throwNameError(int) const;
|
||||
[[noreturn]] void throwError(int) const override;
|
||||
[[noreturn]] void throwNameError(int) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<Deps> m_pDeps;
|
||||
std::mutex m_mutex;
|
||||
};
|
||||
|
||||
@ -840,7 +840,7 @@ bool ArchNetworkWinsock::isEqualAddr(ArchNetAddress a, ArchNetAddress b)
|
||||
return (a == b || (a->m_len == b->m_len && memcmp(&a->m_addr, &b->m_addr, a->m_len) == 0));
|
||||
}
|
||||
|
||||
void ArchNetworkWinsock::throwError(int err)
|
||||
[[noreturn]] void ArchNetworkWinsock::throwError(int err) const
|
||||
{
|
||||
switch (err) {
|
||||
case WSAEACCES:
|
||||
@ -910,7 +910,7 @@ void ArchNetworkWinsock::throwError(int err)
|
||||
}
|
||||
}
|
||||
|
||||
void ArchNetworkWinsock::throwNameError(int err)
|
||||
[[noreturn]] void ArchNetworkWinsock::throwNameError(int err) const
|
||||
{
|
||||
switch (err) {
|
||||
case WSAHOST_NOT_FOUND:
|
||||
|
||||
@ -92,10 +92,9 @@ private:
|
||||
|
||||
void setBlockingOnSocket(SOCKET, bool blocking);
|
||||
|
||||
void throwError(int);
|
||||
void throwNameError(int);
|
||||
[[noreturn]] void throwError(int) const override;
|
||||
[[noreturn]] void throwNameError(int) const override;
|
||||
|
||||
private:
|
||||
using EventList = std::list<WSAEVENT>;
|
||||
|
||||
std::mutex m_mutex;
|
||||
|
||||
Reference in New Issue
Block a user