OldServerPinger

Server-list prober: C00Handshake(47, STATUS) + C00 query + C01 ping sequence feeding the multiplayer latency readout.

net/minecraft/client/network/OldServerPinger.java

Updated 2026-09-12

Deep Analysis

Client-side multiplayer list pinger owned by server-selection GUI. Opens a temporary STATUS connection, parses MOTD, version, player count and favicon, then measures ping. Falls back to pre-1.7 MC|PingHost legacy ping when modern handshake fails.

Key Methods in Depth (7)

ping

Start modern STATUS ping against a ServerData entry

ping starts a modern STATUS ping from the multiplayer list against a ServerData entry. It resolves ServerAddress from serverIP, creates a NetworkManager with createNetworkManagerAndConnect, and adds it to pingDestinations for ticking. It initializes serverMOTD to Pinging, pingToServer to -1, and playerList to null as pending state. It installs an anonymous INetHandlerStatusClient whose handleServerInfo parses S00, handlePong computes latency, and onDisconnect triggers legacy fallback. After installing the handler it sends C00Handshake with protocol 47, host, port, and STATUS next state to switch the channel from HANDSHAKE to STATUS. It then sends C00PacketServerQuery to request ServerStatusResponse. The server replies with S00PacketServerInfo followed by S01PacketPong echo after the client C01PacketPing. Failures are logged without crashing the list thread.

        try
        {
            networkmanager.sendPacket(new C00Handshake(47, serveraddress.getIP(), serveraddress.getPort(), EnumConnectionState.STATUS));
            networkmanager.sendPacket(new C00PacketServerQuery());
        }
        catch (Throwable throwable)
        {
            logger.error((Object)throwable);
        }
    }

The try block sends the two-packet STATUS opening sequence on the fresh NetworkManager. C00Handshake carries protocol 47 plus host and port and requests STATUS state. C00PacketServerQuery then asks for MOTD, version, players, and favicon. Throwables are logged so a bad address does not break the server list. Replies arrive as S00 and S01 handled by the anonymous handler.

handleServerInfo

Parse S00 server info into ServerData display fields

handleServerInfo handles incoming S00PacketServerInfo and prepares the latency probe. It first rejects duplicate S00 with a Received unrequested status close to avoid double parsing. On first reply it marks field_183009_e true and extracts ServerStatusResponse via getResponse. It copies MOTD formatted text into serverMOTD, protocol name and number into gameVersion and version, and online versus max counts into populationInfo with gray formatting. It builds playerList tooltip from GameProfile names plus an and N more suffix when sampled players are fewer than online count. It validates favicon prefix data:image/png;base64 before storing base64 icon data else logs invalid icon. It records field_175092_e with Minecraft.getSystemTime and sends C01PacketPing with that timestamp. The server will echo it in S01PacketPong so handlePong can compute pingToServer. It sets field_147403_d true to suppress legacy fallback.

                    if (serverstatusresponse.getFavicon() != null)
                    {
                        String s = serverstatusresponse.getFavicon();

                        if (s.startsWith("data:image/png;base64,"))
                        {
                            server.setBase64EncodedIconData(s.substring("data:image/png;base64,".length()));
                        }
                        else
                        {
                            OldServerPinger.logger.error("Invalid server icon (unknown format)");
                        }
                    }
                    else
                    {
                        server.setBase64EncodedIconData((String)null);
                    }

                    this.field_175092_e = Minecraft.getSystemTime();
                    networkmanager.sendPacket(new C01PacketPing(this.field_175092_e));
                    this.field_147403_d = true;

The favicon branch validates the data URL prefix before caching icon bytes else logs an error. Clearing icon to null when absent removes stale images from the list. Recording system time in field_175092_e provides the latency baseline. Sending C01PacketPing with that value asks the server for an S01 echo. Setting field_147403_d marks the query complete to block compatibility ping.

handlePong

Compute latency and close ping channel

handlePong handles incoming S01PacketPong and finalizes latency measurement. It reads the stored send time field_175092_e set when C01PacketPing was sent from handleServerInfo. It reads current time via Minecraft.getSystemTime as the receive time. It subtracts send from receive into server.pingToServer in milliseconds for the list display. It then closes the channel with Finished message to terminate the STATUS session cleanly. The outer pingPendingNetworks loop will later remove the closed NetworkManager and call checkDisconnected. No further packets are sent on this connection after close. Duplicate pongs are unlikely because the server closes after one S01.

            public void handlePong(S01PacketPong packetIn)
            {
                long i = this.field_175092_e;
                long j = Minecraft.getSystemTime();
                server.pingToServer = j - i;
                networkmanager.closeChannel(new ChatComponentText("Finished"));
            }
            public void onDisconnect(IChatComponent reason)

The handler ignores packetIn time and uses the stored send timestamp for consistency. Getting system time at receipt captures round-trip delay including server processing. Assigning j minus i to pingToServer updates the list column. Closing with Finished ends the STATUS connection so resources are freed.

onDisconnect

Handle failed modern ping and trigger legacy fallback

onDisconnect runs when the STATUS channel closes and decides whether to try legacy ping. It checks field_147403_d which is set true only after a valid S00 plus C01PacketPing sequence completed. If true it does nothing because modern ping succeeded even if the close reason is Finished or Cancelled. If false it logs Can't ping plus server IP and reason text via OldServerPinger logger. It sets serverMOTD to dark red Can't connect to server and clears populationInfo. It then calls tryCompatibilityPing on the outer OldServerPinger to attempt a pre-1.7 0xFE MC|PingHost exchange over raw Netty. That fallback can populate version, MOTD, and counts for old servers. Modern servers that refused the handshake will show the error text if legacy also fails.

            public void onDisconnect(IChatComponent reason)
            {
                if (!this.field_147403_d)
                {
                    OldServerPinger.logger.error("Can\'t ping " + server.serverIP + ": " + reason.getUnformattedText());
                    server.serverMOTD = EnumChatFormatting.DARK_RED + "Can\'t connect to server.";
                    server.populationInfo = "";
                    OldServerPinger.this.tryCompatibilityPing(server);
                }
            }

The !field_147403_d guard distinguishes failed queries from normal Finished closes. Logging includes serverIP and disconnect text for diagnostics. Setting MOTD and populationInfo provides immediate list feedback. Delegating to tryCompatibilityPing opens a raw 0xFE channel for 1.6-era servers.

tryCompatibilityPing

Legacy 1.6 Beta-style 0xFE ping over raw Netty

tryCompatibilityPing implements the legacy 1.6 Beta-style 0xFE server-list ping over raw Netty. It resolves ServerAddress and builds a Bootstrap on CLIENT_NIO_EVENTLOOP with NioSocketChannel and a ChannelInitializer. The initializer enables TCP_NODELAY and installs a SimpleChannelInboundHandler for ByteBuf. On channelActive it writes packet 0xFE, 1, 0xFA MC|PingHost with host string length, IP chars, and port integer, then flushes with CLOSE_ON_FAILURE. On channelRead0 it reads unsigned byte and expects 0xFF kick response, decodes UTF-16BE length-prefixed string, and splits on NUL with PING_RESPONSE_SPLITTER limit 6. If element zero equals section-1 it parses protocol, version, MOTD, online, and max with parseIntWithDefault into server fields. It then closes the context while exceptionCaught also closes on error. No modern C00 or S00 packets are used on this path.

                        public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception
                        {
                            super.channelActive(p_channelActive_1_);
                            ByteBuf bytebuf = Unpooled.buffer();

                            try
                            {
                                bytebuf.writeByte(254);
                                bytebuf.writeByte(1);
                                bytebuf.writeByte(250);
                                char[] achar = "MC|PingHost".toCharArray();
                                bytebuf.writeShort(achar.length);

                                for (char c0 : achar)
                                {
                                    bytebuf.writeChar(c0);
                                }

                                bytebuf.writeShort(7 + 2 * serveraddress.getIP().length());
                                bytebuf.writeByte(127);
                                achar = serveraddress.getIP().toCharArray();
                                bytebuf.writeShort(achar.length);

                                for (char c1 : achar)
                                {
                                    bytebuf.writeChar(c1);
                                }

                                bytebuf.writeInt(serveraddress.getPort());
                                p_channelActive_1_.channel().writeAndFlush(bytebuf).addListener(ChannelFutureListener.CLOSE_ON_FAILURE);
                            }

channelActive fires when the raw TCP connection opens before any STATUS handshake. Allocating an Unpooled buffer lets the code manually encode the 0xFE plus MC|PingHost payload. Writing 254, 1, 250 plus length-prefixed chars reproduces the Beta 1.8 ping format. Appending IP chars and port tells legacy servers which virtual host is queried. Flushing with CLOSE_ON_FAILURE sends the probe while cleaning up on write error.

pingPendingNetworks

Pump pending ping connections each client tick

pingPendingNetworks pumps all outstanding server-list pings each client tick. It synchronizes on pingDestinations because ping and network threads can add or iterate concurrently. It obtains an iterator so closed channels can be removed safely during traversal. For each NetworkManager it checks isChannelOpen and if open calls processReceivedPackets to dispatch S00 to handleServerInfo and S01 to handlePong. If closed it removes the entry from the list and calls checkDisconnected to fire onDisconnect with the close reason. That disconnect step is what triggers legacy fallback when modern query never completed. It runs on the client thread from GuiMultiplayer update logic. Without this pump no STATUS replies would be processed.

    public void pingPendingNetworks()
    {
        synchronized (this.pingDestinations)
        {
            Iterator<NetworkManager> iterator = this.pingDestinations.iterator();

            while (iterator.hasNext())
            {
                NetworkManager networkmanager = (NetworkManager)iterator.next();

                if (networkmanager.isChannelOpen())
                {
                    networkmanager.processReceivedPackets();
                }
                else
                {
                    iterator.remove();
                    networkmanager.checkDisconnected();
                }
            }
        }
    }

Synchronizing on pingDestinations prevents concurrent modification from ping creation. The iterator loop visits each pending NetworkManager once per tick. Open channels have processReceivedPackets decode and dispatch STATUS packets. Closed channels are removed and passed to checkDisconnected to deliver the disconnect reason. That callback completes latency display or legacy fallback.

clearPendingNetworks

Cancel all outstanding server-list pings

clearPendingNetworks cancels every outstanding server-list ping, typically when leaving multiplayer GUI. It synchronizes on pingDestinations for thread safety with concurrent ping adds. It iterates with an iterator to allow removal while traversing. For each NetworkManager it checks isChannelOpen and only acts on still-open connections. It removes the open entry from the list first to prevent pingPendingNetworks from processing it. It then calls closeChannel with Cancelled message to close TCP and fire onDisconnect. Already-closed entries are left for pingPendingNetworks cleanup rather than double-closed here. After return no modern STATUS or legacy 0xFE probes from this pinger remain active.

    public void clearPendingNetworks()
    {
        synchronized (this.pingDestinations)
        {
            Iterator<NetworkManager> iterator = this.pingDestinations.iterator();

            while (iterator.hasNext())
            {
                NetworkManager networkmanager = (NetworkManager)iterator.next();

                if (networkmanager.isChannelOpen())
                {
                    iterator.remove();
                    networkmanager.closeChannel(new ChatComponentText("Cancelled"));
                }
            }
        }
    }

The synchronized block guards the shared ping list during cancellation. The iterator with isChannelOpen filter targets only live connections. Removing before close avoids race with the tick pump. Closing with Cancelled terminates handshake, query, or ping waits and releases Netty resources.

Packet Usage

PacketDirTrigger
C00Handshakesentping sends protocol 47 with STATUS next state
C00PacketServerQuerysentping server query after handshake
C01PacketPingsenthandleServerInfo timestamp echo for latency
S00PacketServerInfohandledhandleServerInfo updates MOTD and player list
S01PacketPonghandledhandlePong computes pingToServer
0xFE/0xFFsenttryCompatibilityPing legacy MC|PingHost exchange

Internal State

pingDestinationsSynchronized list of active ping NetworkManagers
PING_RESPONSE_SPLITTERNUL splitter with limit 6 for legacy ping parsing
loggerLogs ping failures and invalid favicon formats
field_175092_ePing send timestamp used for latency calc
field_147403_dMarks query completion to gate fallback ping

Related Vanilla Internals

Full Source

OldServerPinger.java315 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.network;
2
3
import com.google.common.base.Charsets;
4
import com.google.common.base.Splitter;
5
import com.google.common.collect.Iterables;
6
import com.google.common.collect.Lists;
7
import com.mojang.authlib.GameProfile;
8
import io.netty.bootstrap.Bootstrap;
9
import io.netty.buffer.ByteBuf;
10
import io.netty.buffer.Unpooled;
11
import io.netty.channel.Channel;
12
import io.netty.channel.ChannelException;
13
import io.netty.channel.ChannelFutureListener;
14
import io.netty.channel.ChannelHandler;
15
import io.netty.channel.ChannelHandlerContext;
16
import io.netty.channel.ChannelInitializer;
17
import io.netty.channel.ChannelOption;
18
import io.netty.channel.EventLoopGroup;
19
import io.netty.channel.SimpleChannelInboundHandler;
20
import io.netty.channel.socket.nio.NioSocketChannel;
21
import java.net.InetAddress;
22
import java.net.UnknownHostException;
23
import java.util.Collections;
24
import java.util.Iterator;
25
import java.util.List;
26
import net.minecraft.client.Minecraft;
27
import net.minecraft.client.multiplayer.ServerAddress;
28
import net.minecraft.client.multiplayer.ServerData;
29
import net.minecraft.network.EnumConnectionState;
30
import net.minecraft.network.NetworkManager;
31
import net.minecraft.network.ServerStatusResponse;
32
import net.minecraft.network.handshake.client.C00Handshake;
33
import net.minecraft.network.status.INetHandlerStatusClient;
34
import net.minecraft.network.status.client.C00PacketServerQuery;
35
import net.minecraft.network.status.client.C01PacketPing;
36
import net.minecraft.network.status.server.S00PacketServerInfo;
37
import net.minecraft.network.status.server.S01PacketPong;
38
import net.minecraft.util.ChatComponentText;
39
import net.minecraft.util.EnumChatFormatting;
40
import net.minecraft.util.IChatComponent;
41
import net.minecraft.util.MathHelper;
42
import org.apache.commons.lang3.ArrayUtils;
43
import org.apache.logging.log4j.LogManager;
44
import org.apache.logging.log4j.Logger;
45
46
public class OldServerPinger
47
{
48
    private static final Splitter PING_RESPONSE_SPLITTER = Splitter.on('\u0000').limit(6);
49
    private static final Logger logger = LogManager.getLogger();
50
    private final List<NetworkManager> pingDestinations = Collections.<NetworkManager>synchronizedList(Lists.<NetworkManager>newArrayList());
51
52
    public void ping(final ServerData server) throws UnknownHostException
53
    {
54
        ServerAddress serveraddress = ServerAddress.fromString(server.serverIP);
55
        final NetworkManager networkmanager = NetworkManager.createNetworkManagerAndConnect(InetAddress.getByName(serveraddress.getIP()), serveraddress.getPort(), false);
56
        this.pingDestinations.add(networkmanager);
57
        server.serverMOTD = "Pinging...";
58
        server.pingToServer = -1L;
59
        server.playerList = null;
60
        networkmanager.setNetHandler(new INetHandlerStatusClient()
61
        {
62
            private boolean field_147403_d = false;
63
            private boolean field_183009_e = false;
64
            private long field_175092_e = 0L;
65
            public void handleServerInfo(S00PacketServerInfo packetIn)
66
            {
67
                if (this.field_183009_e)
68
                {
69
                    networkmanager.closeChannel(new ChatComponentText("Received unrequested status"));
70
                }
71
                else
72
                {
73
                    this.field_183009_e = true;
74
                    ServerStatusResponse serverstatusresponse = packetIn.getResponse();
75
76
                    if (serverstatusresponse.getServerDescription() != null)
77
                    {
78
                        server.serverMOTD = serverstatusresponse.getServerDescription().getFormattedText();
79
                    }
80
                    else
81
                    {
82
                        server.serverMOTD = "";
83
                    }
84
85
                    if (serverstatusresponse.getProtocolVersionInfo() != null)
86
                    {
87
                        server.gameVersion = serverstatusresponse.getProtocolVersionInfo().getName();
88
                        server.version = serverstatusresponse.getProtocolVersionInfo().getProtocol();
89
                    }
90
                    else
91
                    {
92
                        server.gameVersion = "Old";
93
                        server.version = 0;
94
                    }
95
96
                    if (serverstatusresponse.getPlayerCountData() != null)
97
                    {
98
                        server.populationInfo = EnumChatFormatting.GRAY + "" + serverstatusresponse.getPlayerCountData().getOnlinePlayerCount() + "" + EnumChatFormatting.DARK_GRAY + "/" + EnumChatFormatting.GRAY + serverstatusresponse.getPlayerCountData().getMaxPlayers();
99
100
                        if (ArrayUtils.isNotEmpty(serverstatusresponse.getPlayerCountData().getPlayers()))
101
                        {
102
                            StringBuilder stringbuilder = new StringBuilder();
103
104
                            for (GameProfile gameprofile : serverstatusresponse.getPlayerCountData().getPlayers())
105
                            {
106
                                if (stringbuilder.length() > 0)
107
                                {
108
                                    stringbuilder.append("\n");
109
                                }
110
111
                                stringbuilder.append(gameprofile.getName());
112
                            }
113
114
                            if (serverstatusresponse.getPlayerCountData().getPlayers().length < serverstatusresponse.getPlayerCountData().getOnlinePlayerCount())
115
                            {
116
                                if (stringbuilder.length() > 0)
117
                                {
118
                                    stringbuilder.append("\n");
119
                                }
120
121
                                stringbuilder.append("... and ").append(serverstatusresponse.getPlayerCountData().getOnlinePlayerCount() - serverstatusresponse.getPlayerCountData().getPlayers().length).append(" more ...");
122
                            }
123
124
                            server.playerList = stringbuilder.toString();
125
                        }
126
                    }
127
                    else
128
                    {
129
                        server.populationInfo = EnumChatFormatting.DARK_GRAY + "???";
130
                    }
131
132
                    if (serverstatusresponse.getFavicon() != null)
133
                    {
134
                        String s = serverstatusresponse.getFavicon();
135
136
                        if (s.startsWith("data:image/png;base64,"))
137
                        {
138
                            server.setBase64EncodedIconData(s.substring("data:image/png;base64,".length()));
139
                        }
140
                        else
141
                        {
142
                            OldServerPinger.logger.error("Invalid server icon (unknown format)");
143
                        }
144
                    }
145
                    else
146
                    {
147
                        server.setBase64EncodedIconData((String)null);
148
                    }
149
150
                    this.field_175092_e = Minecraft.getSystemTime();
151
                    networkmanager.sendPacket(new C01PacketPing(this.field_175092_e));
152
                    this.field_147403_d = true;
153
                }
154
            }
155
            public void handlePong(S01PacketPong packetIn)
156
            {
157
                long i = this.field_175092_e;
158
                long j = Minecraft.getSystemTime();
159
                server.pingToServer = j - i;
160
                networkmanager.closeChannel(new ChatComponentText("Finished"));
161
            }
162
            public void onDisconnect(IChatComponent reason)
163
            {
164
                if (!this.field_147403_d)
165
                {
166
                    OldServerPinger.logger.error("Can\'t ping " + server.serverIP + ": " + reason.getUnformattedText());
167
                    server.serverMOTD = EnumChatFormatting.DARK_RED + "Can\'t connect to server.";
168
                    server.populationInfo = "";
169
                    OldServerPinger.this.tryCompatibilityPing(server);
170
                }
171
            }
172
        });
173
174
        try
175
        {
176
            networkmanager.sendPacket(new C00Handshake(47, serveraddress.getIP(), serveraddress.getPort(), EnumConnectionState.STATUS));
177
            networkmanager.sendPacket(new C00PacketServerQuery());
178
        }
179
        catch (Throwable throwable)
180
        {
181
            logger.error((Object)throwable);
182
        }
183
    }
184
185
    private void tryCompatibilityPing(final ServerData server)
186
    {
187
        final ServerAddress serveraddress = ServerAddress.fromString(server.serverIP);
188
        ((Bootstrap)((Bootstrap)((Bootstrap)(new Bootstrap()).group((EventLoopGroup)NetworkManager.CLIENT_NIO_EVENTLOOP.getValue())).handler(new ChannelInitializer<Channel>()
189
        {
190
            protected void initChannel(Channel p_initChannel_1_) throws Exception
191
            {
192
                try
193
                {
194
                    p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(true));
195
                }
196
                catch (ChannelException var3)
197
                {
198
                    ;
199
                }
200
201
                p_initChannel_1_.pipeline().addLast(new ChannelHandler[] {new SimpleChannelInboundHandler<ByteBuf>()
202
                    {
203
                        public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception
204
                        {
205
                            super.channelActive(p_channelActive_1_);
206
                            ByteBuf bytebuf = Unpooled.buffer();
207
208
                            try
209
                            {
210
                                bytebuf.writeByte(254);
211
                                bytebuf.writeByte(1);
212
                                bytebuf.writeByte(250);
213
                                char[] achar = "MC|PingHost".toCharArray();
214
                                bytebuf.writeShort(achar.length);
215
216
                                for (char c0 : achar)
217
                                {
218
                                    bytebuf.writeChar(c0);
219
                                }
220
221
                                bytebuf.writeShort(7 + 2 * serveraddress.getIP().length());
222
                                bytebuf.writeByte(127);
223
                                achar = serveraddress.getIP().toCharArray();
224
                                bytebuf.writeShort(achar.length);
225
226
                                for (char c1 : achar)
227
                                {
228
                                    bytebuf.writeChar(c1);
229
                                }
230
231
                                bytebuf.writeInt(serveraddress.getPort());
232
                                p_channelActive_1_.channel().writeAndFlush(bytebuf).addListener(ChannelFutureListener.CLOSE_ON_FAILURE);
233
                            }
234
                            finally
235
                            {
236
                                bytebuf.release();
237
                            }
238
                        }
239
                        protected void channelRead0(ChannelHandlerContext p_channelRead0_1_, ByteBuf p_channelRead0_2_) throws Exception
240
                        {
241
                            short short1 = p_channelRead0_2_.readUnsignedByte();
242
243
                            if (short1 == 255)
244
                            {
245
                                String s = new String(p_channelRead0_2_.readBytes(p_channelRead0_2_.readShort() * 2).array(), Charsets.UTF_16BE);
246
                                String[] astring = (String[])Iterables.toArray(OldServerPinger.PING_RESPONSE_SPLITTER.split(s), String.class);
247
248
                                if ("\u00a71".equals(astring[0]))
249
                                {
250
                                    int i = MathHelper.parseIntWithDefault(astring[1], 0);
251
                                    String s1 = astring[2];
252
                                    String s2 = astring[3];
253
                                    int j = MathHelper.parseIntWithDefault(astring[4], -1);
254
                                    int k = MathHelper.parseIntWithDefault(astring[5], -1);
255
                                    server.version = -1;
256
                                    server.gameVersion = s1;
257
                                    server.serverMOTD = s2;
258
                                    server.populationInfo = EnumChatFormatting.GRAY + "" + j + "" + EnumChatFormatting.DARK_GRAY + "/" + EnumChatFormatting.GRAY + k;
259
                                }
260
                            }
261
262
                            p_channelRead0_1_.close();
263
                        }
264
                        public void exceptionCaught(ChannelHandlerContext p_exceptionCaught_1_, Throwable p_exceptionCaught_2_) throws Exception
265
                        {
266
                            p_exceptionCaught_1_.close();
267
                        }
268
                    }
269
                });
270
            }
271
        })).channel(NioSocketChannel.class)).connect(serveraddress.getIP(), serveraddress.getPort());
272
    }
273
274
    public void pingPendingNetworks()
275
    {
276
        synchronized (this.pingDestinations)
277
        {
278
            Iterator<NetworkManager> iterator = this.pingDestinations.iterator();
279
280
            while (iterator.hasNext())
281
            {
282
                NetworkManager networkmanager = (NetworkManager)iterator.next();
283
284
                if (networkmanager.isChannelOpen())
285
                {
286
                    networkmanager.processReceivedPackets();
287
                }
288
                else
289
                {
290
                    iterator.remove();
291
                    networkmanager.checkDisconnected();
292
                }
293
            }
294
        }
295
    }
296
297
    public void clearPendingNetworks()
298
    {
299
        synchronized (this.pingDestinations)
300
        {
301
            Iterator<NetworkManager> iterator = this.pingDestinations.iterator();
302
303
            while (iterator.hasNext())
304
            {
305
                NetworkManager networkmanager = (NetworkManager)iterator.next();
306
307
                if (networkmanager.isChannelOpen())
308
                {
309
                    iterator.remove();
310
                    networkmanager.closeChannel(new ChatComponentText("Cancelled"));
311
                }
312
            }
313
        }
314
    }
315
}

Deobfuscated MCP 1.8.9 source of OldServerPinger from Marcelektro/MavenMCP-1.8.9 (net/minecraft/client/network/OldServerPinger.java), stored verbatim.