after more little-big endian issues, people can now connect
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/networking@13128 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -106,18 +106,11 @@ void ConnectToServer::update()
|
||||
}
|
||||
break;
|
||||
case SELF_ADDRESS_SHOWN:
|
||||
if (m_listener->getProtocolState(m_current_protocol_id)
|
||||
== PROTOCOL_STATE_TERMINATED) // we have put a request to access the server
|
||||
{
|
||||
m_state = REQUEST_DONE;
|
||||
m_current_protocol_id = m_listener->requestStart(new PingProtocol(m_server_address, 0.5));
|
||||
}
|
||||
break;
|
||||
case REQUEST_DONE:
|
||||
if (m_listener->getProtocolState(m_current_protocol_id)
|
||||
== PROTOCOL_STATE_TERMINATED) // we have put a request to access the server
|
||||
{
|
||||
m_state = CONNECTING;
|
||||
m_current_protocol_id = m_listener->requestStart(new PingProtocol(m_server_address, 2.0));
|
||||
}
|
||||
break;
|
||||
case CONNECTING: // waiting the server to answer our connection
|
||||
|
||||
@@ -46,7 +46,6 @@ class ConnectToServer : public Protocol, public CallbackObject
|
||||
SELF_ADDRESS_KNOWN,
|
||||
PEER_ADDRESS_KNOWN,
|
||||
SELF_ADDRESS_SHOWN,
|
||||
REQUEST_DONE,
|
||||
CONNECTING,
|
||||
CONNECTED,
|
||||
HIDING_ADDRESS,
|
||||
|
||||
@@ -62,13 +62,8 @@ void GetPeerAddress::update()
|
||||
if (rec_success == "yes")
|
||||
{
|
||||
TransportAddress* addr = static_cast<TransportAddress*>(m_callback_object);
|
||||
uint32_t reversed_ip;
|
||||
result->get("ip", &reversed_ip);
|
||||
result->get("ip", &addr->ip);
|
||||
result->get("port", &addr->port);
|
||||
addr->ip = ((reversed_ip&0xff000000) >> 24)
|
||||
+((reversed_ip&0x00ff0000) >> 8)
|
||||
+((reversed_ip&0x0000ff00) << 8)
|
||||
+((reversed_ip&0x000000ff) << 24);
|
||||
Log::info("GetPeerAddress", "Address gotten successfully.");
|
||||
}
|
||||
else
|
||||
|
||||
@@ -39,7 +39,11 @@ STKPeer::~STKPeer()
|
||||
bool STKPeer::connectToHost(STKHost* localhost, TransportAddress host, uint32_t channel_count, uint32_t data)
|
||||
{
|
||||
ENetAddress address;
|
||||
address.host = host.ip;
|
||||
address.host =
|
||||
((host.ip & 0xff000000) >> 24)
|
||||
+ ((host.ip & 0x00ff0000) >> 8)
|
||||
+ ((host.ip & 0x0000ff00) << 8)
|
||||
+ ((host.ip & 0x000000ff) << 24);
|
||||
address.port = host.port;
|
||||
|
||||
ENetPeer* peer = enet_host_connect(localhost->m_host, &address, 2, 0);
|
||||
|
||||
Reference in New Issue
Block a user