address->addresstype = LHNETADDRESSTYPE_NONE;
port = 0;
colon = strrchr(string, ':');
- if (colon)
+ if (colon && (colon == strchr(string, ':') || (string[0] == '[' && colon - string > 0 && colon[-1] == ']')))
+ // EITHER: colon is the ONLY colon OR: colon comes after [...] delimited IPv6 address
+ // fixes misparsing of IPv6 addresses without port
+ {
port = atoi(colon + 1);
+ }
else
colon = string + strlen(string);
if (port == 0)
Con_Print("Connection refused\n");
return 0;
}
- Con_Printf("LHNET_Read: recvfrom returned error: %s\n", LHNETPRIVATE_StrError());
+ Con_DPrintf("LHNET_Read: recvfrom returned error: %s\n", LHNETPRIVATE_StrError());
}
}
#ifdef SUPPORTIPV6
Con_Print("Connection refused\n");
return 0;
}
- Con_Printf("LHNET_Read: recvfrom returned error: %s\n", LHNETPRIVATE_StrError());
+ Con_DPrintf("LHNET_Read: recvfrom returned error: %s\n", LHNETPRIVATE_StrError());
}
}
#endif
{
if (SOCKETERRNO == EWOULDBLOCK)
return 0;
- Con_Printf("LHNET_Write: sendto returned error: %s\n", LHNETPRIVATE_StrError());
+ Con_DPrintf("LHNET_Write: sendto returned error: %s\n", LHNETPRIVATE_StrError());
}
}
#ifdef SUPPORTIPV6
{
if (SOCKETERRNO == EWOULDBLOCK)
return 0;
- Con_Printf("LHNET_Write: sendto returned error: %s\n", LHNETPRIVATE_StrError());
+ Con_DPrintf("LHNET_Write: sendto returned error: %s\n", LHNETPRIVATE_StrError());
}
}
#endif