| 230 | } |
| 231 | |
| 232 | void TelnetDebugger::setDebugParameters(S32 port, const char *password, bool waitForClient) |
| 233 | { |
| 234 | // Don't bail if same port... we might just be wanting to change |
| 235 | // the password. |
| 236 | // if(port == mAcceptPort) |
| 237 | // return; |
| 238 | |
| 239 | if(mAcceptSocket != NetSocket::INVALID) |
| 240 | { |
| 241 | Net::closeSocket(mAcceptSocket); |
| 242 | mAcceptSocket = NetSocket::INVALID; |
| 243 | } |
| 244 | mAcceptPort = port; |
| 245 | if(mAcceptPort != -1 && mAcceptPort != 0) |
| 246 | { |
| 247 | NetAddress address; |
| 248 | Net::getIdealListenAddress(&address); |
| 249 | address.port = mAcceptPort; |
| 250 | |
| 251 | mAcceptSocket = Net::openSocket(); |
| 252 | Net::bindAddress(address, mAcceptSocket); |
| 253 | Net::listen(mAcceptSocket, 4); |
| 254 | |
| 255 | Net::setBlocking(mAcceptSocket, false); |
| 256 | } |
| 257 | dStrncpy(mDebuggerPassword, password, PasswordMaxLength); |
| 258 | |
| 259 | mWaitForClient = waitForClient; |
| 260 | if ( !mWaitForClient ) |
| 261 | return; |
| 262 | |
| 263 | // Wait for the client to fully connect. |
| 264 | while ( mState != Connected ) |
| 265 | { |
| 266 | Platform::sleep(10); |
| 267 | process(); |
| 268 | } |
| 269 | |
| 270 | } |
| 271 | |
| 272 | void TelnetDebugger::processConsoleLine(const char *consoleLine) |
| 273 | { |
no test coverage detected