Comments (24)
the problem is that mtproto requires you to update the client's salt every 30 minutes with one communicated by the server, this salt is actually usable by the client for 60 minutes but after 30 minutes the server starts sending you replies with the new salt.
The mtproto client has to ask for the new salt before the current one expires, but if get_future_salts doesn't get an answer when it starts (sometimes it has happened to me), this request will never be made.
However, after 60 minutes as the current salt will no longer be accepted and the mtproto client will be forced to update the salt with a new one communicated by the server, in which case my client can still manage it, the only annoyance being the error log.
from ll-mtproto.
I have modified how the client requests a salt from the mtproto server, I have made that if I do not receive a reply within 30 seconds I re-execute another request, so as to avoid your case where the client is left with an old server_salt because get_future_salts has not replied and still the mtproto server accepts the old salt but only replies with a new one
from ll-mtproto.
@iamDonkey can try?
from ll-mtproto.
@iamDonkey can try?
I will try soon and let you know
from ll-mtproto.
still getting this error endlessly i noticed it starts to give error around 20mins after launch.
from ll-mtproto.
Can you send me debug level logs from client startup until this happens
from ll-mtproto.
proper functioning of the client should look like this
(30 minutes later)
DEBUG:root:sending message (ping) 7100142388728814516 to mtproto
DEBUG:root:received message (pong) 7100142388872326145 from mtproto
DEBUG:root:pong message: -7104915902057347489
DEBUG:root:sending message (get_future_salts) 7100142502120849004 to mtproto
ERROR:root:received a message with unknown salt! -3968728431761421443
DEBUG:root:received message (future_salts) 7100142502301487105 from mtproto
DEBUG:root:scheduling get_future_salts, current salt is valid for 1801 seconds
from ll-mtproto.
I am doing more tests i will post update soon.
from ll-mtproto.
hi @andrew-ld
fresh log here https://pastebin.com/raw/sMZxy1Gk
this time error came after 24mins
running another test and will post result in next 30 mins.
from ll-mtproto.
another log https://pastebin.com/raw/fWZC0Fdm
this time error came in 21mins but it must be noted that same error was printed at the time of client launch as well?
i let it run for more than 30mins and found the error disappear after 30mins as it gets new salt from server
log here https://pastebin.com/raw/qQ785nHa
from ll-mtproto.
https://core.telegram.org/mtproto/service_messages#request-for-several-future-salts
from ll-mtproto.
The problem I'm noticing is that the salt can expire even before 30 minutes, I need to be able to handle this case, the problem is that get_future_salts apparently doesn't return the exact time of how long that salt expires so I don't actually know after how long to do it.
from ll-mtproto.
{'_cons': 'future_salts', 'req_msg_id': 7100299230082561864, 'now': 1653167239, 'salts': [{'_cons': 'future_salt', 'valid_since': 1653166095, 'valid_until': 1653169695, 'salt': -7268505024579983429}, {'_cons': 'future_salt', 'valid_since': 1653167895, 'valid_until': 1653171495, 'salt': -3011236082352035825}]}
according to the received response salt has lifetime of 3600 seconds/60minutes/1hr?
from ll-mtproto.
The correct solution would be to request 64 future salt and keep them pinned in the client and when I receive a message with a different salt if present in one of these future salts I have to update the salt present in the authkey with the one received
from ll-mtproto.
@iamDonkey The server accepts the correct salt for 60 minutes however after 30 minutes it already no longer uses it in messages from the server to the client but still the client can continue to use it to send messages to the server, in fact if you see I have a min() in the function that calculates the expiration of the current salt
from ll-mtproto.
The correct solution would be to request 64 future salt and keep them pinned in the client and when I receive a message with a different salt if present in one of these future salts I have to update the salt present in the authkey with the one received
i think no need extra rpc calls and work.
just replace the client side stored server salt with server returned salt silently if they are not same? and not show any warning or error.
will that work?
from ll-mtproto.
No better to check with the salts already obtained before, because this is to prevent replay attack, and I think by doing so I would make the client vulnerable to some security bug.
from ll-mtproto.
if you obtain 64 salts at the launch time how long it can run without sending another get_future_salts
i don't like sending additional calls. so far this is the best mtproto library i ever found. it runs on memory as low as 20MB. i hope and wish you will not make this library heavy and hard like other libraries.
from ll-mtproto.
keeping 64 salt in memory is almost irrelevant in total ram usage
from ll-mtproto.
I use this library to keep more than 1000 bots connected in parallel without using too much ram, so it will always remain the 'main goal not occupy more RAM than necessary
from ll-mtproto.
keeping 64 salt in memory is almost irrelevant in total ram usage
Yes but i want to know howlong these 64salts last for?
from ll-mtproto.
I may have found a better way, it should work.
from ll-mtproto.
from the expiry time of the salt I subtract the current time so that I know when the salt will expire and then remove 1800 seconds, basically removing the time when the salt is valid from the client to the server but not from the server to the client
from ll-mtproto.
It's better now.
from ll-mtproto.
Related Issues (7)
- how to use this library? HOT 12
- Unknown constructor 0x1cb5c415 HOT 3
- layer 140 HOT 4
- multithread async deserialize HOT 12
- response to json HOT 10
- ConnectionResetError HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ll-mtproto.