[tarantool-patches] Re: [PATCH 1/4] swim: move sockaddr_in checkers to swim_proto.h

Konstantin Osipov kostja at tarantool.org
Thu Apr 18 18:16:41 MSK 2019


* Vladislav Shpilevoy <v.shpilevoy at tarantool.org> [19/04/18 17:11]:
> Sorry, accidentally broke a test. The fix is
> force pushed:
> 
> ======================================================
> swim_inaddr_is_empty(const struct sockaddr_in *addr)
>  {
> -	return addr->sin_port == 0 && addr->sin_addr.s_addr == 0;
> +	return addr->sin_port == 0 || addr->sin_addr.s_addr == 0;
>  }

This means you haven't paused to explain or test or add a
pre-condition check to the setter function.
Why either of the components can be empty, not both? Shouldn't 
you check for such broken addresses when setting them, to not
allow setting them at all?

The patch is OK to push obviously, just food for thought.

-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov




More information about the Tarantool-patches mailing list