On Fri Oct 18 20:36:14 2024 +0000, Alistair Leslie-Hughes wrote:
This looks wrong. Isn't this just "if (addr->sin_port != connection->addr.sin_port)" ? Same for s_addr.
Could you please explain in more detail why you think it's wrong?
Note that our RB tree requires the comparison function to return a negative value when the first item is less than the second, a positive one when greater, and zero when the items are equal.
Or did you mean something like this: ```suggestion:-8+0 if ( connection_key->addr.sin_port != connection->key.addr.sin_port ) return connection_key->addr.sin_port < connection->key.addr.sin_port ? -1 : 1;
if ( connection_key->addr.sin_addr.s_addr != connection->key.addr.sin_addr.s_addr ) return connection_key->addr.sin_addr.s_addr < connection->key.addr.sin_addr.s_addr ? -1 : 1; ```