Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

prevent stomping on service lookups #9

Merged
merged 1 commit into from

2 participants

@jtolds

No description provided.

@ccutrer ccutrer merged commit 92af082 into ccutrer:next
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 17, 2012
  1. @jtolds
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 5 deletions.
  1. +6 −4 mordor/socket.cpp
  2. +1 −1  mordor/socket.h
View
10 mordor/socket.cpp
@@ -1630,10 +1630,12 @@ IPAddress::lookup(const std::string &host, int family, int type, int protocol,
protocol);
std::vector<ptr> result;
result.reserve(addrResult.size());
- for(unsigned int i = 0; i < addrResult.size(); ++i) {
- ptr addr = boost::dynamic_pointer_cast<IPAddress>(addrResult[i]);
- if(addr) {
- addr->port(port);
+ for (std::vector<Address::ptr>::const_iterator it(addrResult.begin());
+ it != addrResult.end();
+ ++it) {
+ ptr addr = boost::dynamic_pointer_cast<IPAddress>(*it);
+ if (addr) {
+ if (port >= 0) addr->port(port);
result.push_back(addr);
}
}
View
2  mordor/socket.h
@@ -241,7 +241,7 @@ struct IPAddress : public Address
public:
static std::vector<ptr>
lookup(const std::string& host, int family = AF_UNSPEC,
- int type = 0, int protocol = 0, int port = 0);
+ int type = 0, int protocol = 0, int port = -1);
/// Create an IPAddress from a numeric string
/// @note port should be provided in native-endian format
Something went wrong with that request. Please try again.