GithubHelp home page GithubHelp logo

Threading issue with addProxy about td HOT 3 CLOSED

wizche avatar wizche commented on May 21, 2024 1
Threading issue with addProxy

from td.

Comments (3)

levlam avatar levlam commented on May 21, 2024 1

AddProxy will return response after the request will be completed, no matter from which thread it is sent. But the request can't be complited before the TDLib instance is initialized (SetTdlibParameters is called). If the request isn't return, then it is because SetTdlibParameters is never called.

from td.

wizche avatar wizche commented on May 21, 2024 1

Hi @levlam, thanks a lot for the prompt answer!
It seems that I may not have grasped the correct sequence for utilizing the proxy API.
So what you have to do is initiate the library using SetTdlibParameters call and subsequently incorporate your proxies with AddProxy. Those proxies are kept into the session/cache so if you restart the program they are saved. I guess its clear now.

Just one question, why dont you just raise exception on AddProxy when the lib is not initialized?
That would make it easier to spot the API misusage.

from td.

levlam avatar levlam commented on May 21, 2024 1

It is better to call AddProxy before SetTdlibParameters. This is supported and intended order of the calls, otherwise you may try to connect without proxy first. But you must not wait synchronously for AddProxy response. Waiting synchronously for request response is a bad idea most of the time.

from td.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.