]> git.karo-electronics.de Git - karo-tx-linux.git/commit
tipc: consolidate connection-oriented message reception in one function
authorYing Xue <ying.xue@windriver.com>
Thu, 29 Nov 2012 23:39:14 +0000 (18:39 -0500)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Fri, 7 Dec 2012 22:23:20 +0000 (17:23 -0500)
commit7e6c131e1568dcc2033736739a9880dce1976886
tree218e2e4cdcd69d1e2e58ab707c8cb3561cddc586
parentbc879117d4cf2a6fcf5c5a43f157143bbbe88e84
tipc: consolidate connection-oriented message reception in one function

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: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
[PG: add cast to fix warning; remove returns from middle of switch]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
net/tipc/socket.c