Merge pull request #2352 from leyyin/fix-compilation

Fix linux compilation
This commit is contained in:
Deve 2015-10-16 10:43:10 +02:00
commit 9b5e4e9201
3 changed files with 12 additions and 9 deletions

View File

@ -191,8 +191,10 @@ void ConnectToServer::asynchronousUpdate()
if (ifa->ifa_addr->sa_family==AF_INET) if (ifa->ifa_addr->sa_family==AF_INET)
{ {
sa = (struct sockaddr_in *) ifa->ifa_addr; sa = (struct sockaddr_in *) ifa->ifa_addr;
if (ntohl(sa->sin_addr.s_addr) == sender.m_ip) // this interface is ours
sender.m_ip = 0x7f000001; // 127.0.0.1 // This interface is ours
if (ntohl(sa->sin_addr.s_addr) == sender.getIP())
sender.setIP(0x7f000001); // 127.0.0.1
} }
} }
freeifaddrs(ifap); freeifaddrs(ifap);

View File

@ -270,7 +270,7 @@ uint8_t* STKHost::receiveRawPacket(TransportAddress* sender)
if (addr.sin_family == AF_INET) if (addr.sin_family == AF_INET)
{ {
Log::info("STKHost", "IPv4 Address of the sender was %s", sender->toString()); Log::info("STKHost", "IPv4 Address of the sender was %s", sender->toString().c_str());
} }
STKHost::logPacket(NetworkString(std::string((char*)(buffer), len)), true); STKHost::logPacket(NetworkString(std::string((char*)(buffer), len)), true);
return buffer; return buffer;

View File

@ -51,6 +51,7 @@ class TransportAddress : public CallbackObject
private: private:
uint32_t m_ip; //!< The IPv4 address uint32_t m_ip; //!< The IPv4 address
uint16_t m_port; //!< The port number uint16_t m_port; //!< The port number
public: public:
/** Constructor. */ /** Constructor. */
TransportAddress(uint32_t ip = 0, uint16_t port = 0) TransportAddress(uint32_t ip = 0, uint16_t port = 0)