From 4e81d5cf94e408fcc1398359abeea9a7afc7fdb9 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Thu, 26 Apr 2012 10:10:33 +0200 Subject: Don't resolve DNS names in rs_peer_set_address(). It simply stores (a copy of) hostname and service name in PEER. --- lib/peer.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/peer.c b/lib/peer.c index e4f76a2..6e06424 100644 --- a/lib/peer.c +++ b/lib/peer.c @@ -10,6 +10,7 @@ #include #include "err.h" #include "peer.h" +#include "util.h" struct rs_peer * peer_pick_peer (struct rs_connection *conn) @@ -68,14 +69,15 @@ int rs_peer_set_address (struct rs_peer *peer, const char *hostname, const char *service) { - struct rs_error *err; - assert (peer); - assert (peer->realm); + assert (peer->conn); + assert (peer->conn->ctx); + + peer->hostname = rs_strdup (peer->conn->ctx, hostname); + peer->service = rs_strdup (peer->conn->ctx, service); + if (peer->hostname == NULL || peer->service == NULL) + return RSE_NOMEM; - err = rs_resolve (&peer->addr, peer->realm->type, hostname, service); - if (err) - return err_conn_push_err (peer->conn, err); return RSE_OK; } -- cgit v1.1