|
@@ -880,14 +880,13 @@ IfaceMgr::send(const Pkt4Ptr& pkt) {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-boost::shared_ptr<Pkt4>
|
|
|
|
-IfaceMgr::receive4(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */) {
|
|
|
|
|
|
+Pkt4Ptr IfaceMgr::receive4(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */) {
|
|
// Sanity check for microsecond timeout.
|
|
// Sanity check for microsecond timeout.
|
|
if (timeout_usec >= 1000000) {
|
|
if (timeout_usec >= 1000000) {
|
|
isc_throw(BadValue, "fractional timeout must be shorter than"
|
|
isc_throw(BadValue, "fractional timeout must be shorter than"
|
|
" one million microseconds");
|
|
" one million microseconds");
|
|
}
|
|
}
|
|
- const SocketInfo* candidate = 0;
|
|
|
|
|
|
+ boost::scoped_ptr<SocketInfo> candidate;
|
|
IfacePtr iface;
|
|
IfacePtr iface;
|
|
fd_set sockets;
|
|
fd_set sockets;
|
|
int maxfd = 0;
|
|
int maxfd = 0;
|
|
@@ -972,7 +971,7 @@ IfaceMgr::receive4(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */) {
|
|
BOOST_FOREACH(iface, ifaces_) {
|
|
BOOST_FOREACH(iface, ifaces_) {
|
|
BOOST_FOREACH(SocketInfo s, iface->getSockets()) {
|
|
BOOST_FOREACH(SocketInfo s, iface->getSockets()) {
|
|
if (FD_ISSET(s.sockfd_, &sockets)) {
|
|
if (FD_ISSET(s.sockfd_, &sockets)) {
|
|
- candidate = &(s);
|
|
|
|
|
|
+ candidate.reset(new SocketInfo(s));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -997,7 +996,7 @@ Pkt6Ptr IfaceMgr::receive6(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */
|
|
" one million microseconds");
|
|
" one million microseconds");
|
|
}
|
|
}
|
|
|
|
|
|
- const SocketInfo* candidate = 0;
|
|
|
|
|
|
+ boost::scoped_ptr<SocketInfo> candidate;
|
|
fd_set sockets;
|
|
fd_set sockets;
|
|
int maxfd = 0;
|
|
int maxfd = 0;
|
|
|
|
|
|
@@ -1082,7 +1081,7 @@ Pkt6Ptr IfaceMgr::receive6(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */
|
|
BOOST_FOREACH(IfacePtr iface, ifaces_) {
|
|
BOOST_FOREACH(IfacePtr iface, ifaces_) {
|
|
BOOST_FOREACH(SocketInfo s, iface->getSockets()) {
|
|
BOOST_FOREACH(SocketInfo s, iface->getSockets()) {
|
|
if (FD_ISSET(s.sockfd_, &sockets)) {
|
|
if (FD_ISSET(s.sockfd_, &sockets)) {
|
|
- candidate = &(s);
|
|
|
|
|
|
+ candidate.reset(new SocketInfo(s));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|