tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

searchPublicChat sometimes has not callback, why? #2366

Closed liaoxingquan closed 1 year ago

liaoxingquan commented 1 year ago
HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
td_api::object_ptr<td_api::chat> chat;
send_query(td_api::make_object<td_api::searchPublicChat>(query),
    [this, &chat, hEvent](Object object) {
    if (object->get_id() == td_api::error::ID) {
        SendErrorMsg(object);
        SetEvent(hEvent);
        return;
    }
    chat = td::move_tl_object_as<td_api::chat>(object);
    SetEvent(hEvent);
});
WaitForSingleObject(hEvent_, INFINITE);
CloseHandle(hEvent);
    return chat;

If there is no callback, my process is not return I don't know why

levlam commented 1 year ago

All requests return result after they are completed. The issue can be in the SendErrorMsg function, or with the network access. You need to check TDLib logs for details.

liaoxingquan commented 1 year ago

SendErrorMsg this is my function, I interrupted a bit, process has not going there, but my process is MFC project, how to check TDLib logs

liaoxingquan commented 1 year ago

I don't know which function is output logs

levlam commented 1 year ago

You can use setLogStream method to set up logging.

liaoxingquan commented 1 year ago

ok , I try it

liaoxingquan commented 1 year ago

searchPublicChat also has no callback, have no loging info

liaoxingquan commented 1 year ago

There is only some successful login information in the log

levlam commented 1 year ago

If there is no searchPublicChat request in the log with verbosity level >= 3, then the request wasn't sent.