# # patch "ChangeLog" # from [0f49d559713ab0910aa329752d7c9e50536fbda5] # to [467d0a7b22f2787a5929eb873c31cec428f18c4a] # # patch "netsync.cc" # from [268b4567f362e2781c0bd6ed5c29ec009928700b] # to [b85942e30b82c37025d535266b0f317718527b5a] # ======================================================================== --- ChangeLog 0f49d559713ab0910aa329752d7c9e50536fbda5 +++ ChangeLog 467d0a7b22f2787a5929eb873c31cec428f18c4a @@ -1,5 +1,14 @@ 2005-10-10 Timothy Brownawell + Make netsync shutdown work properly. + * netsync.cc (session::which_events): Only ask to read if not armed. + A read failure will discard all read-but-not-processed commands. + * netsync.cc (session::maybe_say_goodbye): Only say goodbye once. + Repeated goodbyes means that one side *will* have a full write-queue + when the connection is torn down. + +2005-10-10 Timothy Brownawell + * tests/t_automate_stdio.at: Add comment here too. 2005-10-10 Timothy Brownawell ======================================================================== --- netsync.cc 268b4567f362e2781c0bd6ed5c29ec009928700b +++ netsync.cc b85942e30b82c37025d535266b0f317718527b5a @@ -1087,17 +1087,18 @@ Netxx::Probe::ready_type session::which_events() const -{ +{ + // Only ask to read if we're not armed. if (outbuf.empty()) { - if (inbuf.size() < constants::netcmd_maxsz) + if (inbuf.size() < constants::netcmd_maxsz && !armed) return Netxx::Probe::ready_read | Netxx::Probe::ready_oobd; else return Netxx::Probe::ready_oobd; } else { - if (inbuf.size() < constants::netcmd_maxsz) + if (inbuf.size() < constants::netcmd_maxsz && !armed) return Netxx::Probe::ready_write | Netxx::Probe::ready_read | Netxx::Probe::ready_oobd; else return Netxx::Probe::ready_write | Netxx::Probe::ready_oobd; @@ -2998,7 +2999,7 @@ session::maybe_say_goodbye() { if (done_all_refinements() && - got_all_data()) + got_all_data() && !sent_goodbye) queue_bye_cmd(); } @@ -3132,7 +3133,7 @@ P(F("got OOB data on fd %d (peer %s), disconnecting\n") % fd % sess.peer_id); return; - } + } if (armed) { @@ -3149,8 +3150,8 @@ P(F("successful exchange with %s\n") % sess.peer_id); return; - } - } + } + } } static void