• Ying Xue's avatar
    tipc: consolidate connection-oriented message reception in one function · 7e6c131e
    Ying Xue authored
    Handling of connection-related message reception is currently scattered
    around at different places in the code. This makes it harder to verify
    that things are handled correctly in all possible scenarios.
    So we consolidate the existing processing of connection-oriented
    message reception in a single routine.  In the process, we convert the
    chain of if/else into a switch/case for improved readability.
    
    A cast on the socket_state in the switch is needed to avoid compile
    warnings on 32 bit, like "net/tipc/socket.c:1252:2: warning: case value
    ‘4294967295’ not in enumerated type".  This happens because existing
    tipc code pseudo extends the default linux socket state values with:
    
    	#define SS_LISTENING    -1      /* socket is listening */
    	#define SS_READY        -2      /* socket is connectionless */
    
    It may make sense to add these as _positive_ values to the existing
    socket state enum list someday, vs. these already existing defines.
    Signed-off-by: default avatarYing Xue <ying.xue@windriver.com>
    Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
    [PG: add cast to fix warning; remove returns from middle of switch]
    Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
    7e6c131e
socket.c 46.8 KB