author | alfadur |
Sun, 04 Aug 2019 02:38:11 +0300 | |
changeset 15293 | 042a5e8d9c59 |
parent 15078 | fb7a9b0119d3 |
child 15891 | d52f5d8e75e6 |
permissions | -rw-r--r-- |
14915 | 1 |
#include "net_session.h" |
2 |
||
15078 | 3 |
#include <QUuid> |
4 |
||
15047
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
5 |
#include "players_model.h" |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
6 |
#include "rooms_model.h" |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
7 |
|
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
8 |
NetSession::NetSession(QObject *parent) |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
9 |
: QObject(parent), |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
10 |
m_playersModel(new PlayersListModel()), |
15078 | 11 |
m_roomsModel(new RoomsListModel()), |
12 |
m_sessionState(NotConnected) {} |
|
15047
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
13 |
|
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
14 |
NetSession::~NetSession() { close(); } |
14915 | 15 |
|
16 |
QUrl NetSession::url() const { return m_url; } |
|
17 |
||
18 |
QAbstractSocket::SocketState NetSession::state() const { |
|
19 |
if (m_socket) |
|
20 |
return m_socket->state(); |
|
21 |
else |
|
22 |
return QAbstractSocket::UnconnectedState; |
|
23 |
} |
|
24 |
||
25 |
void NetSession::open() { |
|
26 |
m_socket.reset(new QTcpSocket()); |
|
27 |
||
28 |
connect(m_socket.data(), &QAbstractSocket::stateChanged, this, |
|
29 |
&NetSession::stateChanged); |
|
30 |
connect(m_socket.data(), &QTcpSocket::readyRead, this, |
|
31 |
&NetSession::onReadyRead); |
|
32 |
||
33 |
m_socket->connectToHost(m_url.host(), |
|
34 |
static_cast<quint16>(m_url.port(46631))); |
|
35 |
} |
|
36 |
||
37 |
QString NetSession::nickname() const { return m_nickname; } |
|
38 |
||
39 |
NetSession::SessionState NetSession::sessionState() const { |
|
40 |
return m_sessionState; |
|
41 |
} |
|
42 |
||
15047
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
43 |
QString NetSession::room() const { return m_room; } |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
44 |
|
15078 | 45 |
QString NetSession::passwordHash() const { return m_passwordHash; } |
46 |
||
14915 | 47 |
void NetSession::setUrl(const QUrl &url) { |
48 |
if (m_url == url) return; |
|
49 |
||
50 |
m_url = url; |
|
51 |
emit urlChanged(m_url); |
|
52 |
} |
|
53 |
||
54 |
void NetSession::setNickname(const QString &nickname) { |
|
55 |
if (m_nickname == nickname) return; |
|
56 |
||
57 |
m_nickname = nickname; |
|
58 |
emit nicknameChanged(m_nickname); |
|
59 |
} |
|
60 |
||
15078 | 61 |
void NetSession::setPasswordHash(const QString &passwordHash) { |
62 |
if (m_passwordHash == passwordHash) return; |
|
14915 | 63 |
|
15078 | 64 |
m_passwordHash = passwordHash; |
65 |
emit passwordHashChanged(m_passwordHash); |
|
66 |
||
67 |
if (m_sessionState == Authentication) sendPassword(); |
|
14915 | 68 |
} |
69 |
||
15047
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
70 |
void NetSession::setRoom(const QString &room) { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
71 |
if (m_room == room) return; |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
72 |
|
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
73 |
m_room = room; |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
74 |
emit roomChanged(m_room); |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
75 |
} |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
76 |
|
14915 | 77 |
void NetSession::close() { |
78 |
if (!m_socket.isNull()) { |
|
79 |
m_socket->disconnectFromHost(); |
|
80 |
m_socket.clear(); |
|
81 |
||
82 |
setSessionState(NotConnected); |
|
15047
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
83 |
setRoom({}); |
14915 | 84 |
} |
85 |
} |
|
86 |
||
87 |
void NetSession::onReadyRead() { |
|
88 |
while (m_socket->canReadLine()) { |
|
89 |
auto line = QString::fromUtf8(m_socket->readLine().simplified()); |
|
90 |
||
91 |
if (line.isEmpty()) { |
|
92 |
parseNetMessage(m_buffer); |
|
93 |
m_buffer.clear(); |
|
94 |
} else { |
|
95 |
m_buffer.append(line); |
|
96 |
} |
|
97 |
} |
|
98 |
} |
|
99 |
||
100 |
void NetSession::parseNetMessage(const QStringList &message) { |
|
101 |
if (message.isEmpty()) { |
|
102 |
qWarning() << "Empty net message received"; |
|
103 |
return; |
|
104 |
} |
|
105 |
||
106 |
qDebug() << "[SERVER]" << message; |
|
107 |
||
108 |
using Handler = std::function<void(NetSession *, const QStringList &)>; |
|
109 |
static QMap<QString, Handler> commandsMap{ |
|
15039 | 110 |
{"ADD_TEAM", &NetSession::handleAddTeam}, |
111 |
{"ASKPASSWORD", &NetSession::handleAskPassword}, |
|
112 |
{"BANLIST", &NetSession::handleBanList}, |
|
113 |
{"BYE", &NetSession::handleBye}, |
|
114 |
{"CFG", &NetSession::handleCfg}, |
|
115 |
{"CHAT", &NetSession::handleChat}, |
|
116 |
{"CLIENT_FLAGS", &NetSession::handleClientFlags}, |
|
14915 | 117 |
{"CONNECTED", &NetSession::handleConnected}, |
15039 | 118 |
{"EM", &NetSession::handleEm}, |
119 |
{"ERROR", &NetSession::handleError}, |
|
120 |
{"HH_NUM", &NetSession::handleHhNum}, |
|
121 |
{"INFO", &NetSession::handleInfo}, |
|
122 |
{"JOINED", &NetSession::handleJoined}, |
|
123 |
{"JOINING", &NetSession::handleJoining}, |
|
124 |
{"KICKED", &NetSession::handleKicked}, |
|
125 |
{"LEFT", &NetSession::handleLeft}, |
|
126 |
{"LOBBY:JOINED", &NetSession::handleLobbyJoined}, |
|
127 |
{"LOBBY:LEFT", &NetSession::handleLobbyLeft}, |
|
128 |
{"NICK", &NetSession::handleNick}, |
|
129 |
{"NOTICE", &NetSession::handleNotice}, |
|
14915 | 130 |
{"PING", &NetSession::handlePing}, |
15039 | 131 |
{"PONG", &NetSession::handlePong}, |
132 |
{"PROTO", &NetSession::handleProto}, |
|
133 |
{"REDIRECT", &NetSession::handleRedirect}, |
|
134 |
{"REMOVE_TEAM", &NetSession::handleRemoveTeam}, |
|
135 |
{"REPLAY_START", &NetSession::handleReplayStart}, |
|
136 |
{"ROOMABANDONED", &NetSession::handleRoomAbandoned}, |
|
137 |
{"ROOM", &NetSession::handleRoom}, |
|
138 |
{"ROOMS", &NetSession::handleRooms}, |
|
139 |
{"ROUND_FINISHED", &NetSession::handleRoundFinished}, |
|
140 |
{"RUN_GAME", &NetSession::handleRunGame}, |
|
141 |
{"SERVER_AUTH", &NetSession::handleServerAuth}, |
|
142 |
{"SERVER_MESSAGE", &NetSession::handleServerMessage}, |
|
143 |
{"SERVER_VARS", &NetSession::handleServerVars}, |
|
144 |
{"TEAM_ACCEPTED", &NetSession::handleTeamAccepted}, |
|
145 |
{"TEAM_COLOR", &NetSession::handleTeamColor}, |
|
146 |
{"WARNING", &NetSession::handleWarning}, |
|
147 |
}; |
|
14915 | 148 |
|
149 |
auto handler = |
|
150 |
commandsMap.value(message[0], &NetSession::handleUnknownCommand); |
|
151 |
||
152 |
handler(this, message.mid(1)); |
|
153 |
} |
|
154 |
||
155 |
void NetSession::handleConnected(const QStringList ¶meters) { |
|
15039 | 156 |
if (parameters.length() < 2 || parameters[1].toInt() < cMinServerVersion) { |
157 |
send("QUIT", "Server too old"); |
|
158 |
emit error(tr("Server too old")); |
|
159 |
close(); |
|
160 |
} else { |
|
161 |
setSessionState(Login); |
|
162 |
||
163 |
send("NICK", m_nickname); |
|
164 |
send("PROTO", QString::number(cProtocolVersion)); |
|
165 |
} |
|
14915 | 166 |
} |
167 |
||
168 |
void NetSession::handlePing(const QStringList ¶meters) { |
|
169 |
send("PONG", parameters); |
|
170 |
} |
|
171 |
||
172 |
void NetSession::handleBye(const QStringList ¶meters) { close(); } |
|
173 |
||
174 |
void NetSession::handleUnknownCommand(const QStringList ¶meters) { |
|
175 |
Q_UNUSED(parameters); |
|
176 |
||
177 |
qWarning() << "Command is not recognized"; |
|
178 |
} |
|
179 |
||
15039 | 180 |
void NetSession::handleAddTeam(const QStringList ¶meters) {} |
181 |
||
15078 | 182 |
void NetSession::handleAskPassword(const QStringList ¶meters) { |
183 |
if (parameters.length() != 1 || parameters[0].length() < 16) { |
|
184 |
qWarning("Bad ASKPASSWORD message"); |
|
185 |
return; |
|
186 |
} |
|
187 |
||
188 |
setSessionState(Authentication); |
|
189 |
||
190 |
m_serverSalt = parameters[0]; |
|
191 |
m_clientSalt = QUuid::createUuid().toString(); |
|
192 |
||
193 |
if (m_passwordHash.isEmpty()) { |
|
194 |
emit passwordAsked(); |
|
195 |
} else { |
|
196 |
sendPassword(); |
|
197 |
} |
|
198 |
} |
|
15039 | 199 |
|
200 |
void NetSession::handleBanList(const QStringList ¶meters) {} |
|
201 |
||
202 |
void NetSession::handleCfg(const QStringList ¶meters) {} |
|
203 |
||
204 |
void NetSession::handleChat(const QStringList ¶meters) {} |
|
205 |
||
206 |
void NetSession::handleClientFlags(const QStringList ¶meters) {} |
|
207 |
||
208 |
void NetSession::handleEm(const QStringList ¶meters) {} |
|
209 |
||
210 |
void NetSession::handleError(const QStringList ¶meters) {} |
|
211 |
||
212 |
void NetSession::handleHhNum(const QStringList ¶meters) {} |
|
213 |
||
214 |
void NetSession::handleInfo(const QStringList ¶meters) {} |
|
215 |
||
216 |
void NetSession::handleJoined(const QStringList ¶meters) {} |
|
217 |
||
218 |
void NetSession::handleJoining(const QStringList ¶meters) {} |
|
219 |
||
220 |
void NetSession::handleKicked(const QStringList ¶meters) {} |
|
221 |
||
222 |
void NetSession::handleLeft(const QStringList ¶meters) {} |
|
223 |
||
15047
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
224 |
void NetSession::handleLobbyJoined(const QStringList ¶meters) { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
225 |
for (auto player : parameters) { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
226 |
if (player == m_nickname) { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
227 |
// check if server is authenticated or no authentication was performed at |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
228 |
// all |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
229 |
if (!m_serverAuthHash.isEmpty()) { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
230 |
emit error(tr("Server authentication error")); |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
231 |
|
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
232 |
close(); |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
233 |
} |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
234 |
|
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
235 |
setSessionState(Lobby); |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
236 |
} |
15039 | 237 |
|
15047
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
238 |
m_playersModel->addPlayer(player, false); |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
239 |
} |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
240 |
} |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
241 |
|
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
242 |
void NetSession::handleLobbyLeft(const QStringList ¶meters) { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
243 |
if (parameters.length() == 1) { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
244 |
m_playersModel->removePlayer(parameters[0]); |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
245 |
} else if (parameters.length() == 2) { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
246 |
m_playersModel->removePlayer(parameters[0], parameters[1]); |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
247 |
} else { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
248 |
qWarning("Malformed LOBBY:LEFT message"); |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
249 |
} |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
250 |
} |
15039 | 251 |
|
252 |
void NetSession::handleNick(const QStringList ¶meters) { |
|
253 |
if (parameters.length()) setNickname(parameters[0]); |
|
254 |
} |
|
255 |
||
256 |
void NetSession::handleNotice(const QStringList ¶meters) {} |
|
257 |
||
258 |
void NetSession::handlePong(const QStringList ¶meters) { |
|
259 |
Q_UNUSED(parameters) |
|
260 |
} |
|
261 |
||
262 |
void NetSession::handleProto(const QStringList ¶meters) {} |
|
263 |
||
264 |
void NetSession::handleRedirect(const QStringList ¶meters) {} |
|
265 |
||
266 |
void NetSession::handleRemoveTeam(const QStringList ¶meters) {} |
|
267 |
||
268 |
void NetSession::handleReplayStart(const QStringList ¶meters) {} |
|
269 |
||
270 |
void NetSession::handleRoomAbandoned(const QStringList ¶meters) {} |
|
271 |
||
15047
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
272 |
void NetSession::handleRoom(const QStringList ¶meters) { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
273 |
if (parameters.size() == 10 && parameters[0] == "ADD") { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
274 |
m_roomsModel->addRoom(parameters.mid(1)); |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
275 |
} else if (parameters.length() == 11 && parameters[0] == "UPD") { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
276 |
m_roomsModel->updateRoom(parameters[1], parameters.mid(2)); |
15039 | 277 |
|
15047
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
278 |
// keep track of room name so correct name is displayed |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
279 |
if (m_room == parameters[1]) { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
280 |
setRoom(parameters[2]); |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
281 |
} |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
282 |
} else if (parameters.size() == 2 && parameters[0] == "DEL") { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
283 |
m_roomsModel->removeRoom(parameters[1]); |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
284 |
} |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
285 |
} |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
286 |
|
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
287 |
void NetSession::handleRooms(const QStringList ¶meters) { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
288 |
if (parameters.size() % 9) { |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
289 |
qWarning("Net: Malformed ROOMS message"); |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
290 |
return; |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
291 |
} |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
292 |
|
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
293 |
m_roomsModel->setRoomsList(parameters); |
773beead236f
Add handling of some messages, reuse models from the old frontend
unc0rr
parents:
15039
diff
changeset
|
294 |
} |
15039 | 295 |
|
296 |
void NetSession::handleRoundFinished(const QStringList ¶meters) {} |
|
297 |
||
298 |
void NetSession::handleRunGame(const QStringList ¶meters) {} |
|
299 |
||
300 |
void NetSession::handleServerAuth(const QStringList ¶meters) {} |
|
301 |
||
302 |
void NetSession::handleServerMessage(const QStringList ¶meters) {} |
|
303 |
||
304 |
void NetSession::handleServerVars(const QStringList ¶meters) {} |
|
305 |
||
306 |
void NetSession::handleTeamAccepted(const QStringList ¶meters) {} |
|
307 |
||
308 |
void NetSession::handleTeamColor(const QStringList ¶meters) {} |
|
309 |
||
310 |
void NetSession::handleWarning(const QStringList ¶meters) {} |
|
311 |
||
14915 | 312 |
void NetSession::send(const QString &message) { send(QStringList(message)); } |
313 |
||
314 |
void NetSession::send(const QString &message, const QString ¶m) { |
|
315 |
send(QStringList{message, param}); |
|
316 |
} |
|
317 |
||
318 |
void NetSession::send(const QString &message, const QStringList ¶meters) { |
|
319 |
send(QStringList(message) + parameters); |
|
320 |
} |
|
321 |
||
322 |
void NetSession::send(const QStringList &message) { |
|
323 |
Q_ASSERT(!m_socket.isNull()); |
|
324 |
||
325 |
qDebug() << "[CLIENT]" << message; |
|
326 |
||
327 |
m_socket->write(message.join('\n').toUtf8() + "\n\n"); |
|
328 |
} |
|
329 |
||
15078 | 330 |
void NetSession::sendPassword() { |
331 |
/* When we got password hash, and server asked us for a password, perform |
|
332 |
* mutual authentication: at this point we have salt chosen by server. Client |
|
333 |
* sends client salt and hash of secret (password hash) salted with client |
|
334 |
* salt, server salt, and static salt (predefined string + protocol number). |
|
335 |
* Server should respond with hash of the same set in different order. |
|
336 |
*/ |
|
337 |
||
338 |
if (m_passwordHash.isEmpty() || m_serverSalt.isEmpty()) return; |
|
339 |
||
340 |
QString hash = |
|
341 |
QCryptographicHash::hash(m_clientSalt.toLatin1() |
|
342 |
.append(m_serverSalt.toLatin1()) |
|
343 |
.append(m_passwordHash) |
|
344 |
.append(QByteArray::number(cProtocolVersion)) |
|
345 |
.append("!hedgewars"), |
|
346 |
QCryptographicHash::Sha1) |
|
347 |
.toHex(); |
|
348 |
||
349 |
m_serverHash = |
|
350 |
QCryptographicHash::hash(m_serverSalt.toLatin1() |
|
351 |
.append(m_clientSalt.toLatin1()) |
|
352 |
.append(m_passwordHash) |
|
353 |
.append(QByteArray::number(cProtocolVersion)) |
|
354 |
.append("!hedgewars"), |
|
355 |
QCryptographicHash::Sha1) |
|
356 |
.toHex(); |
|
357 |
||
358 |
send("PASSWORD", QStringList{hash, m_clientSalt}); |
|
359 |
} |
|
360 |
||
14915 | 361 |
void NetSession::setSessionState(NetSession::SessionState sessionState) { |
362 |
if (m_sessionState == sessionState) return; |
|
363 |
||
364 |
m_sessionState = sessionState; |
|
365 |
||
366 |
emit sessionStateChanged(sessionState); |
|
367 |
} |