Fix ODR violations

This commit is contained in:
Fred Nicolson 2019-05-01 10:27:44 +01:00
parent c23a77d4cc
commit abd6dbebad
No known key found for this signature in database
GPG Key ID: 78C1DD87B47797D2
4 changed files with 30 additions and 24 deletions

View File

@ -103,12 +103,7 @@ namespace fr
*
* @return The socket's descriptor. -1 indicates no connection.
*/
inline int32_t get_socket_descriptor() const noexcept override
{
if(!ssl_socket_descriptor)
return -1;
return ssl_socket_descriptor->fd;
}
int32_t get_socket_descriptor() const override;
/*!
* Sets if the socket should block or not.
@ -119,18 +114,7 @@ namespace fr
* 'SSLError' on failure.
* 'Success' on success.
*/
inline fr::Socket::Status set_blocking(bool should_block) override
{
int ret = mbedtls_net_set_block(ssl_socket_descriptor.get());
if(ret != 0)
{
errno = ret;
return fr::Socket::SSLError;
}
is_blocking = should_block;
return fr::Socket::Success;
}
fr::Socket::Status set_blocking(bool should_block) override;
/*!
* Checks if the socket is blocking
@ -147,10 +131,7 @@ namespace fr
*
* @return True if it's connected. False otherwise.
*/
inline bool connected() const noexcept final
{
return ssl_socket_descriptor && ssl_socket_descriptor->fd > -1;
}
bool connected() const final;
private:

View File

@ -103,7 +103,7 @@ namespace fr
*
* @return True if connected, false otherwise
*/
bool connected() const noexcept override;
bool connected() const override;
/*!
* Gets the underlying socket descriptor.

View File

@ -243,6 +243,19 @@ namespace fr
should_verify = should_verify_;
}
fr::Socket::Status SSLSocket::set_blocking(bool should_block)
{
int ret = mbedtls_net_set_block(ssl_socket_descriptor.get());
if(ret != 0)
{
errno = ret;
return fr::Socket::SSLError;
}
is_blocking = should_block;
return fr::Socket::Success;
}
void SSLSocket::reconfigure_socket()
{
if(!connected())
@ -264,4 +277,16 @@ namespace fr
setsockopt(get_socket_descriptor(), SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeout_dword, sizeof timeout_dword);
#endif
}
int32_t SSLSocket::get_socket_descriptor() const
{
if(!ssl_socket_descriptor)
return -1;
return ssl_socket_descriptor->fd;
}
bool SSLSocket::connected() const
{
return ssl_socket_descriptor && ssl_socket_descriptor->fd > -1;
}
}

View File

@ -248,7 +248,7 @@ namespace fr
#endif
}
bool TcpSocket::connected() const noexcept
bool TcpSocket::connected() const
{
return socket_descriptor > -1;
}