mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-17 08:37:17 -04:00
Use explicit error for timeout
This commit is contained in:
parent
ebbc9e63cd
commit
026406da50
@ -9,6 +9,8 @@
|
||||
#include <string.hpp>
|
||||
#include <expected.hpp>
|
||||
|
||||
#include "tlib/errors.hpp"
|
||||
|
||||
#include "net/arp_cache.hpp"
|
||||
#include "net/arp_layer.hpp"
|
||||
|
||||
@ -181,7 +183,7 @@ std::expected<uint64_t> network::arp::get_mac_force(network::interface_descripto
|
||||
auto end = timer::milliseconds();
|
||||
if(start - end > ms){
|
||||
logging::logf(logging::log_level::TRACE, "arp: reached timeout, exiting\n");
|
||||
return std::make_expected_from_error<uint64_t, size_t>(0);
|
||||
return std::make_expected_from_error<uint64_t>(std::ERROR_SOCKET_TIMEOUT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ constexpr const size_t ERROR_SOCKET_UNIMPLEMENTED = 24;
|
||||
constexpr const size_t ERROR_SOCKET_NO_INTERFACE = 25;
|
||||
constexpr const size_t ERROR_SOCKET_INVALID_PACKET_FD = 26;
|
||||
constexpr const size_t ERROR_SOCKET_NOT_LISTEN = 27;
|
||||
constexpr const size_t ERROR_SOCKET_TIMEOUT = 28;
|
||||
|
||||
inline const char* error_message(size_t error){
|
||||
switch(error){
|
||||
@ -96,6 +97,8 @@ inline const char* error_message(size_t error){
|
||||
return "The packet file descriptor is invalid";
|
||||
case ERROR_SOCKET_NOT_LISTEN:
|
||||
return "The socket is not configured to listen";
|
||||
case ERROR_SOCKET_TIMEOUT:
|
||||
return "Network timeout";
|
||||
default:
|
||||
return "Unknonwn error";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user