@@ -67,16 +67,20 @@ class AuthData {
67
67
void set_main_auth_key (AuthKey auth_key) {
68
68
main_auth_key_ = std::move (auth_key);
69
69
}
70
+
70
71
void break_main_auth_key () {
71
72
main_auth_key_.break_key ();
72
73
}
74
+
73
75
const AuthKey &get_main_auth_key () const {
74
76
// CHECK(has_main_auth_key());
75
77
return main_auth_key_;
76
78
}
79
+
77
80
bool has_main_auth_key () const {
78
81
return !main_auth_key_.empty ();
79
82
}
83
+
80
84
bool need_main_auth_key () const {
81
85
return !has_main_auth_key ();
82
86
}
@@ -85,12 +89,15 @@ class AuthData {
85
89
CHECK (!auth_key.empty ());
86
90
tmp_auth_key_ = std::move (auth_key);
87
91
}
92
+
88
93
const AuthKey &get_tmp_auth_key () const {
89
94
return tmp_auth_key_;
90
95
}
96
+
91
97
bool was_tmp_auth_key () const {
92
98
return use_pfs () && !tmp_auth_key_.empty ();
93
99
}
100
+
94
101
bool need_tmp_auth_key (double now, double refresh_margin) const {
95
102
if (!use_pfs ()) {
96
103
return false ;
@@ -103,12 +110,15 @@ class AuthData {
103
110
}
104
111
return false ;
105
112
}
113
+
106
114
void drop_main_auth_key () {
107
115
main_auth_key_ = AuthKey ();
108
116
}
117
+
109
118
void drop_tmp_auth_key () {
110
119
tmp_auth_key_ = AuthKey ();
111
120
}
121
+
112
122
bool has_tmp_auth_key (double now) const {
113
123
if (!use_pfs ()) {
114
124
return false ;
@@ -128,6 +138,7 @@ class AuthData {
128
138
}
129
139
return get_main_auth_key ();
130
140
}
141
+
131
142
bool has_auth_key (double now) const {
132
143
if (use_pfs ()) {
133
144
return has_tmp_auth_key (now);
@@ -138,6 +149,7 @@ class AuthData {
138
149
bool get_auth_flag () const {
139
150
return main_auth_key_.auth_flag ();
140
151
}
152
+
141
153
void set_auth_flag (bool auth_flag) {
142
154
main_auth_key_.set_auth_flag (auth_flag);
143
155
if (!auth_flag) {
@@ -148,6 +160,7 @@ class AuthData {
148
160
bool get_bind_flag () const {
149
161
return !use_pfs () || tmp_auth_key_.auth_flag ();
150
162
}
163
+
151
164
void on_bind () {
152
165
CHECK (use_pfs ());
153
166
tmp_auth_key_.set_auth_flag (true );
@@ -184,6 +197,7 @@ class AuthData {
184
197
void set_session_id (uint64 session_id) {
185
198
session_id_ = session_id;
186
199
}
200
+
187
201
uint64 get_session_id () const {
188
202
CHECK (session_id_ != 0 );
189
203
return session_id_;
0 commit comments