tdlib / td

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

Function can't be executed synchronously #1109

Closed tingfeng-key closed 4 years ago

tingfeng-key commented 4 years ago

tip:

{"@type":"error","code":400,"message":"Function can't be executed synchronously"}

tblib log:

[ 3][t 4][1592885034.896608114][Td.cpp:4707][#7][!Td][&td_requests]     Sending update: updateOption {
  name = "version"
  value = optionValueString {
    value = "1.6.0"
  }
}
[ 3][t 4][1592885034.896824121][Td.cpp:4707][#7][!Td][&td_requests]     Sending update: updateAuthorizationState {
  authorization_state = authorizationStateWaitTdlibParameters {
  }
}
[ 3][t 0][1592885039.908811092][Client.cpp:270][&td_requests]   Begin to wait for updates with timeout 10.000000
[ 3][t 0][1592885039.908844233][Client.cpp:276][&td_requests]   End to wait for updates, returning object 0 0x7fa0d3a1a0d0
[ 3][t 0][1592885039.908857107][Client.cpp:270][&td_requests]   Begin to wait for updates with timeout 10.000000
[ 3][t 0][1592885039.908869267][Client.cpp:276][&td_requests]   End to wait for updates, returning object 0 0x7fa0d24b2de0
[ 3][t 0][1592885039.908977985][Client.cpp:270][&td_requests]   Begin to wait for updates with timeout 10.000000
[ 3][t 4][1592885039.909199238][Td.cpp:3989][#7][!Td]   Receive Td::hangup
[ 2][t 4][1592885039.909217119][Td.cpp:4234][#7][!Td]   Close Td in state 0
[ 2][t 4][1592885039.909232140][Td.cpp:4088][#7][!Td]   Have no request actors
[ 2][t 4][1592885039.909242153][Td.cpp:4066][#7][!Td]   ON_CLOSED
[ 3][t 4][1592885039.909251213][Td.cpp:4707][#7][!Td][&td_requests]     Sending update: updateAuthorizationState {
  authorization_state = authorizationStateClosed {
  }
}
[ 2][t 4][1592885039.909516096][Td.cpp:4076][#7][!Td]   Stop Td
[ 3][t 0][1592885039.909644127][Client.cpp:276][&td_requests]   End to wait for updates, returning object 0 0x7fa0d2614270
[ 3][t 0][1592885039.909664154][Client.cpp:270][&td_requests]   Begin to wait for updates with timeout 10.000000
[ 3][t 0][1592885039.909674168][Client.cpp:276][&td_requests]   End to wait for updates, returning object 0 0x0

https://github.com/aurimasniekis/php-ffi-tdlib/issues/1#issue-637479909

levlam commented 4 years ago

Only a few TDLib methods can be called synchronously through execute. For most methods you must use send to send the request and receive to receive the response some time later. See https://core.telegram.org/tdlib/getting-started#tdlib-interface for TDLib interface description.

tingfeng-key commented 4 years ago

Can I understand that the function I am calling now does not support execute?

levlam commented 4 years ago

A function can be called synchronously, only if its description in the documentation contains "Can be called synchronously" phrase.