From: Michal Sojka Date: Sat, 19 Feb 2011 13:42:16 +0000 (+0100) Subject: forb: Do not compile inet_broadcast if it is not used X-Git-Url: http://rtime.felk.cvut.cz/gitweb/frescor/frsh-forb.git/commitdiff_plain/bc2fe8748a2c3ddfbfc7340c6caeabc2c9c346b8 forb: Do not compile inet_broadcast if it is not used When inet is the default protocol, broadcasts are not used (because they are not reliable). Previously, if inet was the default, we didn't bind the socket to multicast address and thus we were not able to receive the broadcasts. This situation was confusing and therefore it is better omit the implementation of inet_broadcast entirely to make this clear that it is not used. --- diff --git a/src/forb/src/proto_inet.c b/src/forb/src/proto_inet.c index 39ff70e4..f53043ba 100644 --- a/src/forb/src/proto_inet.c +++ b/src/forb/src/proto_inet.c @@ -424,6 +424,7 @@ inet_port_destroy(forb_port_t * port) return 0; } +#ifndef CONFIG_FORB_PROTO_INET_DEFAULT static ssize_t inet_broadcast(forb_port_t *port, const void *buf, size_t len) { @@ -439,6 +440,7 @@ inet_broadcast(forb_port_t *port, const void *buf, size_t len) (struct sockaddr*)&addr, sizeof(addr)); return ret; } +#endif static void inet_peer_destroy(forb_peer_t *peer) @@ -491,7 +493,9 @@ static const forb_proto_t proto_inet = { .peer_destroy = inet_peer_destroy, .send = inet_send, .recv = inet_recv, +#ifndef CONFIG_FORB_PROTO_INET_DEFAULT .broadcast = inet_broadcast, +#endif .serialize_addr = inet_serialize_addr, .deserialize_addr = inet_deserialize_addr, .addr2str = inet_addr2str,