Network/Socket: Rename ChangeState to UpdateState
Former-commit-id: 96f1909e002c0d1bc7a3ebd173fae799b6ba4770
This commit is contained in:
parent
890e5c75d6
commit
2efaa9dad6
|
|
@ -41,7 +41,7 @@ namespace Nz
|
||||||
protected:
|
protected:
|
||||||
AbstractSocket(SocketType type);
|
AbstractSocket(SocketType type);
|
||||||
|
|
||||||
inline void ChangeState(SocketState newState);
|
inline void UpdateState(SocketState newState);
|
||||||
|
|
||||||
virtual void OnClose();
|
virtual void OnClose();
|
||||||
virtual void OnOpened();
|
virtual void OnOpened();
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ namespace Nz
|
||||||
return m_isBlockingEnabled;
|
return m_isBlockingEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void AbstractSocket::ChangeState(SocketState newState)
|
inline void AbstractSocket::UpdateState(SocketState newState)
|
||||||
{
|
{
|
||||||
if (m_state != newState)
|
if (m_state != newState)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ namespace Nz
|
||||||
|
|
||||||
void AbstractSocket::OnClose()
|
void AbstractSocket::OnClose()
|
||||||
{
|
{
|
||||||
ChangeState(SocketState_NotConnected);
|
UpdateState(SocketState_NotConnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractSocket::OnOpened()
|
void AbstractSocket::OnOpened()
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ namespace Nz
|
||||||
if (state != SocketState_NotConnected)
|
if (state != SocketState_NotConnected)
|
||||||
m_peerAddress = remoteAddress;
|
m_peerAddress = remoteAddress;
|
||||||
|
|
||||||
ChangeState(state);
|
UpdateState(state);
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -89,7 +89,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
// Our connection attempt failed
|
// Our connection attempt failed
|
||||||
m_lastError = error;
|
m_lastError = error;
|
||||||
ChangeState(SocketState_NotConnected);
|
UpdateState(SocketState_NotConnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -104,10 +104,10 @@ namespace Nz
|
||||||
{
|
{
|
||||||
// Other errors mean a problem while getting the peer address
|
// Other errors mean a problem while getting the peer address
|
||||||
if (error == SocketError_ConnectionClosed)
|
if (error == SocketError_ConnectionClosed)
|
||||||
ChangeState(SocketState_NotConnected);
|
UpdateState(SocketState_NotConnected);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ChangeState(SocketState_Connected); // If we are not connecting and have a peer address, we are connected
|
UpdateState(SocketState_Connected); // If we are not connecting and have a peer address, we are connected
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -127,7 +127,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
case SocketError_ConnectionClosed:
|
case SocketError_ConnectionClosed:
|
||||||
case SocketError_ConnectionRefused:
|
case SocketError_ConnectionRefused:
|
||||||
ChangeState(SocketState_NotConnected);
|
UpdateState(SocketState_NotConnected);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -140,7 +140,7 @@ namespace Nz
|
||||||
if (received)
|
if (received)
|
||||||
*received = read;
|
*received = read;
|
||||||
|
|
||||||
ChangeState(SocketState_Connected);
|
UpdateState(SocketState_Connected);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,7 +168,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
case SocketError_ConnectionClosed:
|
case SocketError_ConnectionClosed:
|
||||||
case SocketError_ConnectionRefused:
|
case SocketError_ConnectionRefused:
|
||||||
ChangeState(SocketState_NotConnected);
|
UpdateState(SocketState_NotConnected);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -181,7 +181,7 @@ namespace Nz
|
||||||
totalByteSent += sentSize;
|
totalByteSent += sentSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangeState(SocketState_Connected);
|
UpdateState(SocketState_Connected);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ namespace Nz
|
||||||
if (state == SocketState_Bound)
|
if (state == SocketState_Bound)
|
||||||
m_boundAddress = SocketImpl::QuerySocketAddress(m_handle);
|
m_boundAddress = SocketImpl::QuerySocketAddress(m_handle);
|
||||||
|
|
||||||
ChangeState(state);
|
UpdateState(state);
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ namespace Nz
|
||||||
if (state == SocketState_Bound)
|
if (state == SocketState_Bound)
|
||||||
m_boundAddress = SocketImpl::QuerySocketAddress(m_handle);
|
m_boundAddress = SocketImpl::QuerySocketAddress(m_handle);
|
||||||
|
|
||||||
ChangeState(state);
|
UpdateState(state);
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,13 +67,13 @@ namespace Nz
|
||||||
{
|
{
|
||||||
m_boundAddress = IpAddress::Invalid;
|
m_boundAddress = IpAddress::Invalid;
|
||||||
|
|
||||||
ChangeState(SocketState_NotConnected);
|
UpdateState(SocketState_NotConnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UdpSocket::OnOpened()
|
void UdpSocket::OnOpened()
|
||||||
{
|
{
|
||||||
m_boundAddress = IpAddress::Invalid;
|
m_boundAddress = IpAddress::Invalid;
|
||||||
|
|
||||||
ChangeState(SocketState_NotConnected);
|
UpdateState(SocketState_NotConnected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue