From 21145a29bb70f72860a607cdc43ea2dc55809a2a Mon Sep 17 00:00:00 2001 From: drbob Date: Sun, 10 Jul 2011 00:37:09 +0000 Subject: [PATCH] * added function to extract Local Address from udpstack. * update local address when a reset is called. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-netupgrade@4417 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libbitdht/src/udp/udpstack.cc | 7 +++++++ libbitdht/src/udp/udpstack.h | 1 + 2 files changed, 8 insertions(+) diff --git a/libbitdht/src/udp/udpstack.cc b/libbitdht/src/udp/udpstack.cc index b3ca88e75..e8f0fc043 100644 --- a/libbitdht/src/udp/udpstack.cc +++ b/libbitdht/src/udp/udpstack.cc @@ -75,10 +75,17 @@ UdpLayer *UdpStack::getUdpLayer() /* for testing only */ return udpLayer; } +bool UdpStack::getLocalAddress(struct sockaddr_in &local) +{ + local = laddr; + return true; +} + bool UdpStack::resetAddress(struct sockaddr_in &local) { std::cerr << "UdpStack::resetAddress(" << local << ")"; std::cerr << std::endl; + laddr = local; return udpLayer->reset(local); } diff --git a/libbitdht/src/udp/udpstack.h b/libbitdht/src/udp/udpstack.h index 9aeeed3a1..29bd93f1f 100644 --- a/libbitdht/src/udp/udpstack.h +++ b/libbitdht/src/udp/udpstack.h @@ -78,6 +78,7 @@ virtual ~UdpStack() { return; } UdpLayer *getUdpLayer(); /* for testing only */ +bool getLocalAddress(struct sockaddr_in &local); bool resetAddress(struct sockaddr_in &local);