6 // ------------------------------------------------------------------------------------------------- |
6 // ------------------------------------------------------------------------------------------------- |
7 // |
7 // |
8 RCONSession::RCONSession() : |
8 RCONSession::RCONSession() : |
9 m_state (RCON_DISCONNECTED), |
9 m_state (RCON_DISCONNECTED), |
10 m_lastPing (0), |
10 m_lastPing (0), |
11 m_numAdmins (0) |
11 m_numAdmins (0) {} |
|
12 |
|
13 // ------------------------------------------------------------------------------------------------- |
|
14 // |
|
15 STATIC METHOD |
|
16 RCONSession::new_session() -> RCONSession* |
12 { |
17 { |
13 if (g_rconSession != NULL) |
18 if (g_rconSession != NULL) |
14 { |
19 { |
15 g_rconSession->disconnect(); |
20 g_rconSession->disconnect(); |
16 delete g_rconSession; |
21 delete g_rconSession; |
17 } |
22 } |
18 |
23 |
19 g_rconSession = this; |
24 g_rconSession = new RCONSession; |
20 } |
25 |
21 |
26 if (not g_rconSession->socket()->set_blocking (false)) |
22 // ------------------------------------------------------------------------------------------------- |
|
23 // |
|
24 STATIC METHOD |
|
25 RCONSession::new_session() -> RCONSession* |
|
26 { |
|
27 RCONSession* session = new RCONSession; |
|
28 |
|
29 if (not session->socket()->set_blocking (false)) |
|
30 { |
27 { |
31 print ("unable to set socket as non-blocking: %s\n", |
28 print ("unable to set socket as non-blocking: %s\n", |
32 session->socket()->error_string().chars()); |
29 g_rconSession->socket()->error_string().chars()); |
33 delete session; |
30 delete g_rconSession; |
34 return nullptr; |
31 return nullptr; |
35 } |
32 } |
36 |
33 |
37 return session; |
34 return g_rconSession; |
38 } |
35 } |
39 |
36 |
40 // ------------------------------------------------------------------------------------------------- |
37 // ------------------------------------------------------------------------------------------------- |
41 // |
38 // |
42 RCONSession::~RCONSession() |
39 RCONSession::~RCONSession() |