MCPcopy Create free account
hub / github.com/catabriga/graphwar / run

Method run

src/Graphwar/ServerConnection.java:87–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85 }
86
87 public void run()
88 {
89 running = true;
90
91 while(running)
92 {
93 try
94 {
95 String message = connection.readMessage();
96
97 if(message == null)
98 {
99 gameData.kickFromGame();
100 disconnect();
101 }
102 else
103 {
104 gameData.handleMessage(message);
105
106 if(checkStayAliveTime())
107 {
108 sendKeepAlive();
109 }
110 }
111 }
112 catch (SocketTimeoutException e)
113 {
114 //e.printStackTrace();
115
116 if(checkTimeout())
117 {
118 gameData.kickFromGame();
119 disconnect();
120 }
121 else
122 {
123 sendKeepAlive();
124 }
125 }
126 catch (IOException e)
127 {
128 e.printStackTrace();
129
130 gameData.kickFromGame();
131 disconnect();
132 }
133 }
134 }
135}

Callers

nothing calls this directly

Calls 7

disconnectMethod · 0.95
checkStayAliveTimeMethod · 0.95
sendKeepAliveMethod · 0.95
checkTimeoutMethod · 0.95
readMessageMethod · 0.80
kickFromGameMethod · 0.80
handleMessageMethod · 0.45

Tested by

no test coverage detected