Fix recursive alphabetical search and implement nothing in the socket fix

This commit is contained in:
Daniil Gentili 2018-08-28 20:55:49 +02:00
parent 9eeabaa81b
commit 41c682a12d
6 changed files with 17 additions and 6 deletions

View File

@ -186,10 +186,10 @@ class API extends APIFactory
if ($params === null) {
$params = $this->session;
}
Logger::log(\danog\MadelineProto\Lang::$current_lang['serializing_madelineproto']);
if (empty($params)) {
return;
}
Logger::log(\danog\MadelineProto\Lang::$current_lang['serializing_madelineproto']);
return Serialization::serialize($params, $this);
}

View File

@ -154,7 +154,7 @@ class MTProto
public function __sleep()
{
return ['event_handler', 'event_handler_instance', 'loop_callback', 'web_template', 'encrypted_layer', 'settings', 'config', 'authorization', 'authorized', 'rsa_keys', 'last_recv', 'dh_config', 'chats', 'last_stored', 'qres', 'pending_updates', 'pending_pwrchat', 'postpone_pwrchat', 'updates_state', 'got_state', 'channels_state', 'updates', 'updates_key', 'full_chats', 'msg_ids', 'dialog_params', 'datacenter', 'v', 'constructors', 'td_constructors', 'methods', 'td_methods', 'td_descriptions', 'temp_requested_secret_chats', 'temp_rekeyed_secret_chats', 'secret_chats', 'hook_url', 'storage', 'authorized_dc', 'tos'];
return ['channel_participants', 'event_handler', 'event_handler_instance', 'loop_callback', 'web_template', 'encrypted_layer', 'settings', 'config', 'authorization', 'authorized', 'rsa_keys', 'last_recv', 'dh_config', 'chats', 'last_stored', 'qres', 'pending_updates', 'pending_pwrchat', 'postpone_pwrchat', 'updates_state', 'got_state', 'channels_state', 'updates', 'updates_key', 'full_chats', 'msg_ids', 'dialog_params', 'datacenter', 'v', 'constructors', 'td_constructors', 'methods', 'td_methods', 'td_descriptions', 'temp_requested_secret_chats', 'temp_rekeyed_secret_chats', 'secret_chats', 'hook_url', 'storage', 'authorized_dc', 'tos'];
}
public function __wakeup()

View File

@ -149,7 +149,11 @@ trait CallHandler
$only_updates = false;
$response_tries = $this->settings['max_tries']['response'] + 1;
if ($last_recv) {
$response_tries += (int) floor((time() - $last_recv) / 10);
$additional = (int) floor((time() - $last_recv) / 10);
if ($additional > $this->settings['max_tries']['response']*2) {
$additional = $this->settings['max_tries']['response']*2;
}
$response_tries += $additional;
}
while ($server_answer === null && $res_count++ < $response_tries) {
// Loop until we get a response, loop for a max of $this->settings['max_tries']['response'] times

View File

@ -652,6 +652,7 @@ trait PeerHandler
$limit = 200;
$has_more = false;
$cached = false;
$last_count = -1;
do {
try {
@ -670,7 +671,11 @@ trait PeerHandler
$this->store_participants_cache($gres, $channel, $filter, $q, $offset, $limit);
}
$has_more = $gres['count'] === 10000;
if ($last_count !== -1 && $last_count !== $gres['count']) {
$has_more = true;
} else {
$last_count = $gres['count'];
}
foreach ($gres['participants'] as $participant) {
$newres = [];
@ -712,7 +717,7 @@ trait PeerHandler
}
$res['participants'][$participant['user_id']] = $newres;
}
$this->logger->logger("Fetched channel participants with filter $filter, query $q, offset $offset, limit $limit, hash $hash: ".($cached ? 'cached' : 'not cached').', '.count($gres['participants']).' participants out of '.$gres['count'].', in total fetched '.count($res['participants']).' out of '.$total_count);
$this->logger->logger("Fetched ".count($gres['participants'])." channel participants with filter $filter, query $q, offset $offset, limit $limit, hash $hash: ".($cached ? 'cached' : 'not cached').', '.($offset + count($gres['participants'])).' participants out of '.$gres['count'].', in total fetched '.count($res['participants']).' out of '.$total_count);
$offset += count($gres['participants']);
} while (count($gres['participants']));
@ -726,7 +731,7 @@ trait PeerHandler
public function store_participants_cache($gres, $channel, $filter, $q, $offset, $limit)
{
return;
//return;
unset($gres['users']);
$ids = [];
foreach ($gres['participants'] as $participant) {

View File

@ -19,6 +19,7 @@ trait Tools
{
public function gen_vector_hash($ints)
{
sort($ints, SORT_NUMERIC);
if (\danog\MadelineProto\Magic::$bigint) {
$hash = new \phpseclib\Math\BigInteger(0);
foreach ($ints as $int) {

View File

@ -77,6 +77,7 @@ if ($MadelineProto->get_self() === false) {
\danog\MadelineProto\Logger::log('hey', \danog\MadelineProto\Logger::ERROR);
\danog\MadelineProto\Logger::log('hey', \danog\MadelineProto\Logger::FATAL_ERROR);
/**
* A small example message to use for tests.
*/