From d40854f63beb6e8ef9b720f88a8175bcb69338ae Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Tue, 4 Jul 2006 14:07:45 +0000 Subject: [PATCH] Agrega records al cache. --- practicas/pipi/src/nameserver.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/practicas/pipi/src/nameserver.cpp b/practicas/pipi/src/nameserver.cpp index 23a2e23..82ca2af 100644 --- a/practicas/pipi/src/nameserver.cpp +++ b/practicas/pipi/src/nameserver.cpp @@ -309,7 +309,6 @@ ResolvProtoResponse NameServer::resolv_recursive(const Name& n) std::cerr << "NameServer::resolv_recursive -> gotcha! " << rpr << "\n"; #endif - // TODO agregar a cache break; } return rpr; // Devuelvo el A o NOTFOUND @@ -346,7 +345,6 @@ ResolvProtoResponse NameServer::resolv_recursive_r(const Name& n, std::cerr << "NameServer::resolv_recursive_r -> gotcha! " << r << "\n"; #endif - // TODO agregar a cache return r; // Gotcha! } } @@ -376,6 +374,9 @@ ResolvProtoResponse NameServer::query(const Name& n, const IPAddr& ip) std::cerr << "NameServer::query -> recibido " << resp << " de " << ip << "\n"; #endif + // Agrego a cache + if (resp.ret == RP_RES_A) + cache[n] = CacheRecord(time(NULL) + resp.ttl, resp.ips); return resp; } -- 2.43.0