Add debug for INPUT_METHOD_INVALID and BOT_METHOD_INVALID.
GitOrigin-RevId: dfc4e6c81f80504d2299a59f21cd79633fd98daf
This commit is contained in:
parent
5d1323311a
commit
ea8d5dbda7
@ -38,6 +38,21 @@ int32 NetQuery::tl_magic(const BufferSlice &buffer_slice) {
|
|||||||
return as<int32>(slice.begin());
|
return as<int32>(slice.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetQuery::set_error(Status status, string source) {
|
||||||
|
if (status.code() == Error::Resend || status.code() == Error::Cancelled ||
|
||||||
|
status.code() == Error::ResendInvokeAfter) {
|
||||||
|
return set_error_impl(Status::Error(200, PSLICE() << status), std::move(source));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status.message() == "INPUT_METHOD_INVALID") {
|
||||||
|
LOG(ERROR) << "Receive INPUT_METHOD_INVALID for query " << format::as_hex_dump<4>(Slice(query_.as_slice()));
|
||||||
|
}
|
||||||
|
if (status.message() == "BOT_METHOD_INVALID") {
|
||||||
|
LOG(ERROR) << "Receive BOT_METHOD_INVALID for query " << format::as_hex(tl_constructor());
|
||||||
|
}
|
||||||
|
set_error_impl(std::move(status), std::move(source));
|
||||||
|
}
|
||||||
|
|
||||||
void dump_pending_network_queries() {
|
void dump_pending_network_queries() {
|
||||||
auto n = NetQueryCounter::get_count();
|
auto n = NetQueryCounter::get_count();
|
||||||
LOG(WARNING) << tag("pending net queries", n);
|
LOG(WARNING) << tag("pending net queries", n);
|
||||||
|
@ -133,13 +133,7 @@ class NetQuery : public ListNode {
|
|||||||
void on_net_write(size_t size);
|
void on_net_write(size_t size);
|
||||||
void on_net_read(size_t size);
|
void on_net_read(size_t size);
|
||||||
|
|
||||||
void set_error(Status status, string source = "") {
|
void set_error(Status status, string source = "");
|
||||||
if (status.code() == Error::Resend || status.code() == Error::Cancelled ||
|
|
||||||
status.code() == Error::ResendInvokeAfter) {
|
|
||||||
return set_error_impl(Status::Error(200, PSLICE() << status), std::move(source));
|
|
||||||
}
|
|
||||||
set_error_impl(std::move(status), source);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_error_resend() {
|
void set_error_resend() {
|
||||||
set_error_impl(Status::Error<Error::Resend>());
|
set_error_impl(Status::Error<Error::Resend>());
|
||||||
|
@ -23,8 +23,7 @@ NetQueryCreator::Ptr NetQueryCreator::create(uint64 id, const Storer &storer, Dc
|
|||||||
int32 tl_constructor = NetQuery::tl_magic(slice);
|
int32 tl_constructor = NetQuery::tl_magic(slice);
|
||||||
if (gzip_flag == NetQuery::GzipFlag::On) {
|
if (gzip_flag == NetQuery::GzipFlag::On) {
|
||||||
// TODO: try to compress files?
|
// TODO: try to compress files?
|
||||||
BufferSlice compressed;
|
BufferSlice compressed = gzencode(slice.as_slice());
|
||||||
compressed = gzencode(slice.as_slice());
|
|
||||||
if (compressed.empty()) {
|
if (compressed.empty()) {
|
||||||
gzip_flag = NetQuery::GzipFlag::Off;
|
gzip_flag = NetQuery::GzipFlag::Off;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user