Ton

Форк
0
/
adnl-query.cpp 
47 строк · 1.4 Кб
1
/*
2
    This file is part of TON Blockchain Library.
3

4
    TON Blockchain Library is free software: you can redistribute it and/or modify
5
    it under the terms of the GNU Lesser General Public License as published by
6
    the Free Software Foundation, either version 2 of the License, or
7
    (at your option) any later version.
8

9
    TON Blockchain Library is distributed in the hope that it will be useful,
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
    GNU Lesser General Public License for more details.
13

14
    You should have received a copy of the GNU Lesser General Public License
15
    along with TON Blockchain Library.  If not, see <http://www.gnu.org/licenses/>.
16

17
    Copyright 2017-2020 Telegram Systems LLP
18
*/
19
#include "adnl-query.h"
20
#include "common/errorcode.h"
21
#include "td/utils/Random.h"
22

23
namespace ton {
24

25
namespace adnl {
26

27
void AdnlQuery::alarm() {
28
  set_error(td::Status::Error(ErrorCode::timeout, "adnl query timeout"));
29
}
30
void AdnlQuery::result(td::BufferSlice data) {
31
  promise_.set_value(std::move(data));
32
  stop();
33
}
34
void AdnlQuery::set_error(td::Status error) {
35
  promise_.set_error(std::move(error));
36
  stop();
37
}
38

39
AdnlQueryId AdnlQuery::random_query_id() {
40
  AdnlQueryId q_id;
41
  td::Random::secure_bytes(q_id.as_slice());
42
  return q_id;
43
}
44

45
}  // namespace adnl
46

47
}  // namespace ton
48

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.