From 60b391e2a55749c0cf9e96f53515673a0898a0d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 15 Feb 2015 10:24:20 +0000 Subject: Facebook: Fix for infinite channel "starting"; Version bump This fixes it by better using of random number generator. Now we use rand_s() instead of rand() because of thread safety and also we have random "seed" per each facebook_client with much better initial random seed. Previously when user logged off and then logged in again, it used same randomgly generated clientid which resulted in confusion on Facebook server and "infinite" repeated requests for channel every second from Miranda... This bug was here probably for many months and affected all stable and development versions. git-svn-id: http://svn.miranda-ng.org/main/trunk@12119 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/communication.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'protocols/FacebookRM/src/communication.cpp') diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index cfcbdfbff6..d0cee49e4b 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -541,7 +541,7 @@ std::string facebook_client::choose_action(RequestType request_type, std::string action += "&seq=" + (this->chat_sequence_num_.empty() ? "0" : this->chat_sequence_num_); action += "&partition=" + (this->chat_channel_partition_.empty() ? "0" : this->chat_channel_partition_); action += "&clientid=" + this->chat_clientid_; - action += "&cb=" + utils::text::rand_string(4, "0123456789abcdefghijklmnopqrstuvwxyz"); + action += "&cb=" + utils::text::rand_string(4, "0123456789abcdefghijklmnopqrstuvwxyz", &this->random_); int idleSeconds = parent->IdleSeconds(); action += "&idle=" + utils::conversion::to_string(&idleSeconds, UTILS_CONV_UNSIGNED_NUMBER); @@ -1253,7 +1253,7 @@ bool facebook_client::channel() case HTTP_CODE_GATEWAY_TIMEOUT: // Maybe we have same clientid as other connected client, try to generate different one - this->chat_clientid_ = utils::text::rand_string(8, "0123456789abcdef"); + this->chat_clientid_ = utils::text::rand_string(8, "0123456789abcdef", &this->random_); // Intentionally fall to handle_error() below case HTTP_CODE_FAKE_DISCONNECTED: -- cgit v1.2.3