summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2011-09-17 13:44:58 +0000
committerSimon Howard2011-09-17 13:44:58 +0000
commit22a8e37dbede0d879f15252830b93234a7483fb3 (patch)
tree30482d174fe621d091ed8c59d26b5e01a21befdf /src
parentdf292a6dce27e7b20faa0c829aa0c58a3693f979 (diff)
downloadchocolate-doom-22a8e37dbede0d879f15252830b93234a7483fb3.tar.gz
chocolate-doom-22a8e37dbede0d879f15252830b93234a7483fb3.tar.bz2
chocolate-doom-22a8e37dbede0d879f15252830b93234a7483fb3.zip
Fix ping calculation with LAN search.
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 2378
Diffstat (limited to 'src')
-rw-r--r--src/net_query.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/net_query.c b/src/net_query.c
index 2797ea2e..24af1863 100644
--- a/src/net_query.c
+++ b/src/net_query.c
@@ -242,10 +242,35 @@ static void NET_Query_ParseResponse(net_addr_t *addr, net_packet_t *packet,
return;
}
- // Find the target that responded, or potentially add a new target
- // if it was not already known (for LAN broadcast search)
+ // Find the target that responded.
- target = GetTargetForAddr(addr, true);
+ target = GetTargetForAddr(addr, false);
+
+ // If the target is not found, it may be because we are doing
+ // a LAN broadcast search, in which case we need to create a
+ // target for the new responder.
+
+ if (target == NULL)
+ {
+ query_target_t *broadcast_target;
+
+ broadcast_target = GetTargetForAddr(NULL, false);
+
+ // Not in broadcast mode, unexpected response that came out
+ // of nowhere. Ignore.
+
+ if (broadcast_target == NULL
+ || broadcast_target->state != QUERY_TARGET_QUERIED)
+ {
+ return;
+ }
+
+ // Create new target.
+
+ target = GetTargetForAddr(addr, true);
+ target->state = QUERY_TARGET_QUERIED;
+ target->query_time = broadcast_target->query_time;
+ }
if (target->state != QUERY_TARGET_RESPONDED)
{