1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

pow-testgiver support

This commit is contained in:
ton 2020-07-06 17:07:20 +03:00
parent dbde9c1c40
commit f064b1047a
257 changed files with 6665 additions and 2608 deletions

View file

@ -71,7 +71,7 @@
#define TRY_RESULT_PROMISE(promise_name, name, result) \
TRY_RESULT_PROMISE_IMPL(promise_name, TD_CONCAT(TD_CONCAT(r_, name), __LINE__), auto name, result)
#define TRY_RESULT_ASSIGN(name, result) TRY_RESULT_IMPL(TD_CONCAT(TD_CONCAT(r_, name), __LINE__), name, result)
#define TRY_RESULT_ASSIGN(name, result) TRY_RESULT_IMPL(TD_CONCAT(r_response, __LINE__), name, result)
#define TRY_RESULT_PROMISE_ASSIGN(promise_name, name, result) \
TRY_RESULT_PROMISE_IMPL(promise_name, TD_CONCAT(TD_CONCAT(r_, name), __LINE__), name, result)
@ -133,19 +133,19 @@
#if TD_PORT_POSIX
#define OS_ERROR(message) \
[&]() { \
[&] { \
auto saved_errno = errno; \
return ::td::Status::PosixError(saved_errno, (message)); \
}()
#define OS_SOCKET_ERROR(message) OS_ERROR(message)
#elif TD_PORT_WINDOWS
#define OS_ERROR(message) \
[&]() { \
[&] { \
auto saved_error = ::GetLastError(); \
return ::td::Status::WindowsError(saved_error, (message)); \
}()
#define OS_SOCKET_ERROR(message) \
[&]() { \
[&] { \
auto saved_error = ::WSAGetLastError(); \
return ::td::Status::WindowsError(saved_error, (message)); \
}()
@ -162,7 +162,7 @@ string winerror_to_string(int code);
#endif
class Status {
enum class ErrorType : int8 { general, os };
enum class ErrorType : int8 { General, Os };
public:
Status() = default;
@ -187,7 +187,7 @@ class Status {
}
static Status Error(int err, Slice message = Slice()) TD_WARN_UNUSED_RESULT {
return Status(false, ErrorType::general, err, message);
return Status(false, ErrorType::General, err, message);
}
static Status Error(Slice message) TD_WARN_UNUSED_RESULT {
@ -196,13 +196,13 @@ class Status {
#if TD_PORT_WINDOWS
static Status WindowsError(int saved_error, Slice message) TD_WARN_UNUSED_RESULT {
return Status(false, ErrorType::os, saved_error, message);
return Status(false, ErrorType::Os, saved_error, message);
}
#endif
#if TD_PORT_POSIX
static Status PosixError(int32 saved_errno, Slice message) TD_WARN_UNUSED_RESULT {
return Status(false, ErrorType::os, saved_errno, message);
return Status(false, ErrorType::Os, saved_errno, message);
}
#endif
@ -212,7 +212,7 @@ class Status {
template <int Code>
static Status Error() {
static Status status(true, ErrorType::general, Code, "");
static Status status(true, ErrorType::General, Code, "");
return status.clone_static();
}
@ -222,10 +222,10 @@ class Status {
}
Info info = get_info();
switch (info.error_type) {
case ErrorType::general:
case ErrorType::General:
sb << "[Error";
break;
case ErrorType::os:
case ErrorType::Os:
#if TD_PORT_POSIX
sb << "[PosixError : " << strerror_safe(info.error_code);
#elif TD_PORT_WINDOWS
@ -304,9 +304,9 @@ class Status {
}
Info info = get_info();
switch (info.error_type) {
case ErrorType::general:
case ErrorType::General:
return message().str();
case ErrorType::os:
case ErrorType::Os:
#if TD_PORT_POSIX
return strerror_safe(info.error_code).str();
#elif TD_PORT_WINDOWS
@ -343,10 +343,10 @@ class Status {
CHECK(is_error());
Info info = get_info();
switch (info.error_type) {
case ErrorType::general:
return Error(code(), PSLICE() << prefix << " " << message());
case ErrorType::os:
return Status(false, ErrorType::os, code(), PSLICE() << prefix << " " << message());
case ErrorType::General:
return Error(code(), PSLICE() << prefix << message());
case ErrorType::Os:
return Status(false, ErrorType::Os, code(), PSLICE() << prefix << message());
default:
UNREACHABLE();
return {};
@ -356,10 +356,10 @@ class Status {
CHECK(is_error());
Info info = get_info();
switch (info.error_type) {
case ErrorType::general:
return Error(code(), PSLICE() << message() << " " << suffix);
case ErrorType::os:
return Status(false, ErrorType::os, code(), PSLICE() << message() << " " << suffix);
case ErrorType::General:
return Error(code(), PSLICE() << message() << suffix);
case ErrorType::Os:
return Status(false, ErrorType::Os, code(), PSLICE() << message() << suffix);
default:
UNREACHABLE();
return {};