]> rtime.felk.cvut.cz Git - frescor/forb.git/commitdiff
forb: Do not compile inet_broadcast if it is not used
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sat, 19 Feb 2011 13:42:16 +0000 (14:42 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sat, 19 Feb 2011 15:21:32 +0000 (16:21 +0100)
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.

src/proto_inet.c

index 39ff70e4437c1b6b53ef7d5f970d682cae554105..f53043ba81d487a6a4a5738376d92a9e9ab46bc2 100644 (file)
@@ -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,