MCPcopy Create free account
hub / github.com/demoth/jake2 / CheckForResend

Method CheckForResend

client/src/main/java/jake2/client/CL.java:602–634  ·  view source on GitHub ↗

CheckForResend Resend a connect message if the last one has timed out.

()

Source from the content-addressed store, hash-verified

600 * Resend a connect message if the last one has timed out.
601 */
602 private static void CheckForResend() {
603 // if the local server is running and we aren't
604 // then connect
605 if (ClientGlobals.cls.state == Defines.ca_disconnected
606 && Globals.server_state != ServerStates.SS_DEAD) {
607 ClientGlobals.cls.state = Defines.ca_connecting;
608 ClientGlobals.cls.servername = "localhost";
609 // we don't need a challenge on the localhost
610 SendConnectPacket();
611 return;
612 }
613
614 // resend if we haven't gotten a reply yet
615 if (ClientGlobals.cls.state != Defines.ca_connecting)
616 return;
617
618 if (ClientGlobals.cls.realtime - ClientGlobals.cls.connect_time < 3000)
619 return;
620
621 netadr_t adr = netadr_t.fromString(ClientGlobals.cls.servername, Defines.PORT_SERVER);
622 if (adr == null) {
623 Com.Printf("Bad server address\n");
624 ClientGlobals.cls.state = Defines.ca_disconnected;
625 return;
626 }
627
628 // for retransmit requests
629 ClientGlobals.cls.connect_time = ClientGlobals.cls.realtime;
630
631 Com.Printf("Connecting to " + ClientGlobals.cls.servername + "...\n");
632
633 Netchan.sendConnectionlessPacket(Defines.NS_CLIENT, adr, ConnectionlessCommand.getchallenge, "\n");
634 }
635
636 /**
637 * ClearState

Callers 1

SendCommandMethod · 0.95

Calls 4

SendConnectPacketMethod · 0.95
PrintfMethod · 0.95
fromStringMethod · 0.45

Tested by

no test coverage detected