cmcfarlen commented on code in PR #13821: URL: https://github.com/apache/trafficserver/pull/13821#discussion_r4340799080
########## src/iocore/net/UnixNetVConnection.cc: ########## @@ -1292,13 +1339,14 @@ UnixNetVConnection::set_inactivity_timeout(ink_hrtime timeout_in) Dbg(dbg_ctl_socket, "Set inactive timeout=%" PRId64 ", for NetVC=%p", timeout_in, this); inactivity_timeout_in = timeout_in; next_inactivity_timeout_at = (timeout_in > 0) ? ink_get_hrtime() + inactivity_timeout_in : 0; + rearm_timer(); Review Comment: Fixed in adcce4a24f: clearing the explicit timeout on an enabled connection now arms the default through `arm_default_inactivity_timeout()`, as `cancel_inactivity_timeout()` already did. A real-`UnixNetVConnection` test for this is in 731fbf5dee. ########## src/iocore/net/NetEvent.cc: ########## @@ -0,0 +1,61 @@ +/** @file + + NetEvent timer helpers: owner-thread-safe timer rearm and default inactivity deadline rebasing. + + @section license License + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#include "iocore/net/NetEvent.h" +#include "iocore/net/NetHandler.h" + +void +NetEvent::rearm_timer() +{ + NetHandler *const h = nh; + + if (h == nullptr) { + return; + } + // The owning thread touches its wheel without holding the NetHandler mutex, + // so the mutex does not protect it and a foreign thread must not take it. + if (h->thread == this_ethread()) { + h->rearm_timer(this); + } else { + h->defer_rearm(this); + } +} + +void +NetEvent::rebase_default_inactivity_deadline(ink_hrtime previous_in) +{ + if (!use_default_inactivity_timeout || inactivity_timeout_in != 0 || next_inactivity_timeout_at == 0) { + return; // the deadline did not come from the default + } Review Comment: Fixed in adcce4a24f: when the default changes on a connection with no inactivity deadline, `rebase_default_inactivity_deadline()` now arms it through `arm_default_inactivity_timeout()`, so a per-remap default replacing a global 0 takes effect. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
