zwetan / as3-universal-analytics

Google Universal Analytics for AS3
Mozilla Public License 2.0
73 stars 11 forks source link

error under Linux #8

Closed zwetan closed 8 years ago

zwetan commented 9 years ago

BSDSocketHitSender crash

zwetan commented 9 years ago

in the _open() method we use hints.ai_family = AF_UNSPEC; to support both IPv4 and IPv6

when IPv6 is used the crash occurs because later in the code _remotePort = ntohs( _info.ai_addr.sin_port );

for an IPv6 it should be _remotePort = ntohs( _info.ai_addr.sin6_port ); as ai_addr can be either sockaddr_in or sockaddr_in6

fix is to test the family

if( _info.ai_family == AF_INET )
{
    // IPv4
}
else
{
    // IPv6 eg. _info.ai_family == AF_INET6
}

quick workaround, update hints.ai_family = AF_INET; to force IPv4

zwetan commented 8 years ago

arf off course same problem occurs with _findLocalAddressAndPort()