Preliminary IPV6 Support

This commit is contained in:
James Urquhart 2016-09-10 23:01:10 +01:00
parent 1a851f167d
commit 704577e051
22 changed files with 1712 additions and 592 deletions

View file

@ -151,8 +151,8 @@ TelnetDebugger::TelnetDebugger()
Con::addConsumer(debuggerConsumer);
mAcceptPort = -1;
mAcceptSocket = InvalidSocket;
mDebugSocket = InvalidSocket;
mAcceptSocket = NetSocket::INVALID;
mDebugSocket = NetSocket::INVALID;
mState = NotConnected;
mCurPos = 0;
@ -189,9 +189,9 @@ TelnetDebugger::~TelnetDebugger()
{
Con::removeConsumer(debuggerConsumer);
if(mAcceptSocket != InvalidSocket)
if(mAcceptSocket != NetSocket::INVALID)
Net::closeSocket(mAcceptSocket);
if(mDebugSocket != InvalidSocket)
if(mDebugSocket != NetSocket::INVALID)
Net::closeSocket(mDebugSocket);
}
@ -217,10 +217,10 @@ void TelnetDebugger::send(const char *str)
void TelnetDebugger::disconnect()
{
if ( mDebugSocket != InvalidSocket )
if ( mDebugSocket != NetSocket::INVALID )
{
Net::closeSocket(mDebugSocket);
mDebugSocket = InvalidSocket;
mDebugSocket = NetSocket::INVALID;
}
removeAllBreakpoints();
@ -236,16 +236,20 @@ void TelnetDebugger::setDebugParameters(S32 port, const char *password, bool wai
// if(port == mAcceptPort)
// return;
if(mAcceptSocket != InvalidSocket)
if(mAcceptSocket != NetSocket::INVALID)
{
Net::closeSocket(mAcceptSocket);
mAcceptSocket = InvalidSocket;
mAcceptSocket = NetSocket::INVALID;
}
mAcceptPort = port;
if(mAcceptPort != -1 && mAcceptPort != 0)
{
NetAddress address;
Net::getIdealListenAddress(&address);
address.port = mAcceptPort;
mAcceptSocket = Net::openSocket();
Net::bind(mAcceptSocket, mAcceptPort);
Net::bindAddress(address, mAcceptSocket);
Net::listen(mAcceptSocket, 4);
Net::setBlocking(mAcceptSocket, false);
@ -279,32 +283,33 @@ void TelnetDebugger::process()
{
NetAddress address;
if(mAcceptSocket != InvalidSocket)
if(mAcceptSocket != NetSocket::INVALID)
{
// ok, see if we have any new connections:
NetSocket newConnection;
newConnection = Net::accept(mAcceptSocket, &address);
if(newConnection != InvalidSocket && mDebugSocket == InvalidSocket)
if(newConnection != NetSocket::INVALID && mDebugSocket == NetSocket::INVALID)
{
Con::printf ("Debugger connection from %i.%i.%i.%i",
address.netNum[0], address.netNum[1], address.netNum[2], address.netNum[3]);
char buffer[256];
Net::addressToString(&address, buffer);
Con::printf("Debugger connection from %s", buffer);
mState = PasswordTry;
mDebugSocket = newConnection;
Net::setBlocking(newConnection, false);
}
else if(newConnection != InvalidSocket)
else if(newConnection != NetSocket::INVALID)
Net::closeSocket(newConnection);
}
// see if we have any input to process...
if(mDebugSocket == InvalidSocket)
if(mDebugSocket == NetSocket::INVALID)
return;
checkDebugRecv();
if(mDebugSocket == InvalidSocket)
if(mDebugSocket == NetSocket::INVALID)
removeAllBreakpoints();
}
@ -434,7 +439,7 @@ void TelnetDebugger::breakProcess()
{
Platform::sleep(10);
checkDebugRecv();
if(mDebugSocket == InvalidSocket)
if(mDebugSocket == NetSocket::INVALID)
{
mProgramPaused = false;
removeAllBreakpoints();