# # # patch "network/session.cc" # from [bb67e698a2ddb7f1ebbfde380445dfbf5a76340c] # to [e2a16733fef9dfa4ee37119e79076d1f3b8dee40] # # patch "network/session.hh" # from [f2933718450444adc05d45a42d77d89f8cab9fe6] # to [81adb6499d9a9c275295748095bb40c16dcc9ef2] # # patch "network/wrapped_session.hh" # from [388d677f9580972afd9d55c1732c71d67ade92e4] # to [f3d3c6ac2206d7ba2361d70844819050a203964b] # ============================================================ --- network/session.cc bb67e698a2ddb7f1ebbfde380445dfbf5a76340c +++ network/session.cc e2a16733fef9dfa4ee37119e79076d1f3b8dee40 @@ -57,7 +57,9 @@ session::session(app_state & app, projec app(app), project(project), keys(keys), - peer(peer) + peer(peer), + unnoted_bytes_in(0), + unnoted_bytes_out(0) { } @@ -724,6 +726,30 @@ session::error(int errcode, string const throw netsync_error(errmsg); } +void +session::note_bytes_in(int count) +{ + if (wrapped) + { + wrapped->note_bytes_in(count + unnoted_bytes_in); + unnoted_bytes_in = 0; + } + else + unnoted_bytes_in += count; +} + +void +session::note_bytes_out(int count) +{ + if (wrapped) + { + wrapped->note_bytes_out(count + unnoted_bytes_out); + unnoted_bytes_out = 0; + } + else + unnoted_bytes_out += count; +} + // Local Variables: // mode: C++ // fill-column: 76 ============================================================ --- network/session.hh f2933718450444adc05d45a42d77d89f8cab9fe6 +++ network/session.hh 81adb6499d9a9c275295748095bb40c16dcc9ef2 @@ -68,6 +68,9 @@ class session : public session_base std::string peer; boost::shared_ptr wrapped; + int unnoted_bytes_in; + int unnoted_bytes_out; + void queue_bye_cmd(u8 phase); bool process_bye_cmd(u8 phase, transaction_guard & guard); @@ -103,6 +106,9 @@ public: // ensure that our peer receives the error message. // Affects read_some, write_some, and process . void error(int errcode, std::string const & message); + + void note_bytes_in(int count); + void note_bytes_out(int count); }; #endif ============================================================ --- network/wrapped_session.hh 388d677f9580972afd9d55c1732c71d67ade92e4 +++ network/wrapped_session.hh f3d3c6ac2206d7ba2361d70844819050a203964b @@ -70,6 +70,9 @@ public: virtual void on_begin(size_t ident, key_identity_info const & remote_key); virtual void on_end(size_t ident); + + virtual void note_bytes_in(int count) { return; } + virtual void note_bytes_out(int count) { return; } }; #endif