Add more logging for CHECK.
This commit is contained in:
parent
c0fb888c42
commit
2431afc722
@ -63,7 +63,7 @@ class RawConnection {
|
|||||||
virtual ~Callback() = default;
|
virtual ~Callback() = default;
|
||||||
virtual Status on_raw_packet(const PacketInfo &info, BufferSlice packet) = 0;
|
virtual Status on_raw_packet(const PacketInfo &info, BufferSlice packet) = 0;
|
||||||
virtual Status on_quick_ack(uint64 quick_ack_token) {
|
virtual Status on_quick_ack(uint64 quick_ack_token) {
|
||||||
return Status::Error("Quick acks unsupported fully, but still used");
|
return Status::Error("Quick acknowledgements are unsupported by the callback");
|
||||||
}
|
}
|
||||||
virtual Status before_write() {
|
virtual Status before_write() {
|
||||||
return Status::OK();
|
return Status::OK();
|
||||||
|
@ -173,6 +173,7 @@ namespace mtproto {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
unique_ptr<RawConnection> SessionConnection::move_as_raw_connection() {
|
unique_ptr<RawConnection> SessionConnection::move_as_raw_connection() {
|
||||||
|
was_moved_ = true;
|
||||||
return std::move(raw_connection_);
|
return std::move(raw_connection_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1007,7 +1008,10 @@ void SessionConnection::send_before(double tm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Status SessionConnection::do_flush() {
|
Status SessionConnection::do_flush() {
|
||||||
CHECK(raw_connection_);
|
LOG_CHECK(raw_connection_) << was_moved_ << ' ' << state_ << ' ' << static_cast<int32>(mode_) << ' '
|
||||||
|
<< connected_flag_ << ' ' << is_main_ << ' ' << need_destroy_auth_key_ << ' '
|
||||||
|
<< sent_destroy_auth_key_ << ' ' << callback_ << ' ' << (Time::now() - created_at_) << ' '
|
||||||
|
<< (Time::now() - last_read_at_);
|
||||||
CHECK(state_ != Closed);
|
CHECK(state_ != Closed);
|
||||||
if (state_ == Init) {
|
if (state_ == Init) {
|
||||||
TRY_STATUS(init());
|
TRY_STATUS(init());
|
||||||
|
@ -69,8 +69,13 @@ class SessionConnection final
|
|||||||
: public Named
|
: public Named
|
||||||
, private RawConnection::Callback {
|
, private RawConnection::Callback {
|
||||||
public:
|
public:
|
||||||
enum class Mode { Tcp, Http, HttpLongPoll };
|
enum class Mode : int32 { Tcp, Http, HttpLongPoll };
|
||||||
SessionConnection(Mode mode, unique_ptr<RawConnection> raw_connection, AuthData *auth_data);
|
SessionConnection(Mode mode, unique_ptr<RawConnection> raw_connection, AuthData *auth_data);
|
||||||
|
SessionConnection(const SessionConnection &) = delete;
|
||||||
|
SessionConnection &operator=(const SessionConnection &) = delete;
|
||||||
|
SessionConnection(SessionConnection &&) = delete;
|
||||||
|
SessionConnection &operator=(SessionConnection &&) = delete;
|
||||||
|
~SessionConnection() = default;
|
||||||
|
|
||||||
PollableFdInfo &get_poll_info();
|
PollableFdInfo &get_poll_info();
|
||||||
unique_ptr<RawConnection> move_as_raw_connection();
|
unique_ptr<RawConnection> move_as_raw_connection();
|
||||||
@ -87,7 +92,6 @@ class SessionConnection final
|
|||||||
|
|
||||||
void set_online(bool online_flag, bool is_main);
|
void set_online(bool online_flag, bool is_main);
|
||||||
|
|
||||||
// Callback
|
|
||||||
class Callback {
|
class Callback {
|
||||||
public:
|
public:
|
||||||
Callback() = default;
|
Callback() = default;
|
||||||
@ -132,6 +136,7 @@ class SessionConnection final
|
|||||||
|
|
||||||
bool online_flag_ = false;
|
bool online_flag_ = false;
|
||||||
bool is_main_ = false;
|
bool is_main_ = false;
|
||||||
|
bool was_moved_ = false;
|
||||||
|
|
||||||
int rtt() const {
|
int rtt() const {
|
||||||
return max(2, static_cast<int>(raw_connection_->extra().rtt * 1.5 + 1));
|
return max(2, static_cast<int>(raw_connection_->extra().rtt * 1.5 + 1));
|
||||||
|
Loading…
Reference in New Issue
Block a user