Skip to content

Commit

Permalink
CPP-499 Review markups: error reporting, NULL handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
kw217 committed Apr 20, 2018
1 parent 62da406 commit 3a460f6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gtests/src/integration/tests/test_control_connection.cpp
Expand Up @@ -234,7 +234,7 @@ CASSANDRA_INTEGRATION_TEST_F(ControlConnectionTests,
CHECK_FAILURE;

// Attempt to connect to the server using an unbindable local IP address
logger_.add_critera("Unable to bind local address");
logger_.add_critera("Unable to bind local address: address not available");
Cluster cluster = default_cluster().with_local_address("1.1.1.1");
try {
cluster.connect();
Expand Down
3 changes: 2 additions & 1 deletion src/cluster.cpp
Expand Up @@ -473,8 +473,9 @@ CassError cass_cluster_set_local_address(CassCluster* cluster,
CassError cass_cluster_set_local_address_n(CassCluster* cluster,
const char* name,
size_t name_length) {
cass::Address address;
cass::Address address; // default to AF_UNSPEC
if (name_length == 0 ||
name == NULL ||
cass::Address::from_string(std::string(name, name_length), 0, &address)) {
cluster->config().set_local_address(address);
} else {
Expand Down
5 changes: 3 additions & 2 deletions src/connection.cpp
Expand Up @@ -247,9 +247,10 @@ Connection::Connection(uv_loop_t* loop,

const Address* local_address = config_.local_address();
if (local_address) {
if (uv_tcp_bind(&socket_, local_address->addr(), 0)) {
int rc = uv_tcp_bind(&socket_, local_address->addr(), 0);
if (rc) {
ok = false;
notify_error("Unable to bind local address");
notify_error("Unable to bind local address: " + std::string(UV_ERRSTR(rc, loop_)));
}
}

Expand Down

0 comments on commit 3a460f6

Please sign in to comment.