From f5a245e95db04b771864bfae8e83577d4bedc897 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Thu, 11 Sep 2014 15:20:54 +0200 Subject: [PATCH] Exposing this to use it from other places that use channels --- core/src/main/java/hudson/slaves/ChannelPinger.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/slaves/ChannelPinger.java b/core/src/main/java/hudson/slaves/ChannelPinger.java index 4141af49b8..1e3837a96c 100644 --- a/core/src/main/java/hudson/slaves/ChannelPinger.java +++ b/core/src/main/java/hudson/slaves/ChannelPinger.java @@ -68,6 +68,10 @@ public class ChannelPinger extends ComputerListener { @Override public void preOnline(Computer c, Channel channel, FilePath root, TaskListener listener) { + install(channel); + } + + public void install(Channel channel) { if (pingInterval < 1) { LOGGER.fine("Slave ping is disabled"); return; @@ -75,9 +79,9 @@ public class ChannelPinger extends ComputerListener { try { channel.call(new SetUpRemotePing(pingInterval)); - LOGGER.fine("Set up a remote ping for " + c.getName()); + LOGGER.fine("Set up a remote ping for " + channel.getName()); } catch (Exception e) { - LOGGER.severe("Failed to set up a ping for " + c.getName()); + LOGGER.severe("Failed to set up a ping for " + channel.getName()); } // set up ping from both directions, so that in case of a router dropping a connection, -- GitLab