unet-cli: strip initial newline in usage message
[project/unetd.git] / pex.c
diff --git a/pex.c b/pex.c
index 61977cc007ce1f2cb67a0048d0037a0a48340d6f..854837c8285d91f92c57b4a45734764810a54fc1 100644 (file)
--- a/pex.c
+++ b/pex.c
@@ -344,7 +344,7 @@ network_pex_query_hosts(struct network *net)
                void *id;
 
                if ((net->stun.port_ext && host == net->net_config.local_host) ||
-                   peer->state.connected || peer->endpoint)
+                   peer->state.connected || peer->endpoint || host->gateway)
                        continue;
 
                id = pex_msg_append(PEX_ID_LEN);
@@ -509,10 +509,16 @@ network_pex_recv_query(struct network *net, struct network_peer *peer,
 
        pex_msg_init(net, PEX_MSG_NOTIFY_PEERS);
        for (; len >= 8; data += 8, len -= 8) {
+               struct network_host *host;
+
                cur = pex_msg_peer(net, data, false);
                if (!cur || !cur->state.connected)
                        continue;
 
+               host = container_of(peer, struct network_host, peer);
+               if (host->gateway)
+                       continue;
+
                if (!pex_msg_add_peer_endpoint(net, cur, peer))
                        resp++;
        }