* Accepter
*/
-int Accepter::bind(entity_addr_t &bind_addr, int avoid_port1, int avoid_port2)
+int Accepter::bind(const entity_addr_t &bind_addr, int avoid_port1, int avoid_port2)
{
const md_config_t *conf = msgr->cct->_conf;
// bind to a socket
rc = ::bind(listen_sd, (struct sockaddr *) &listen_addr.ss_addr(), listen_addr.addr_size());
if (rc < 0) {
char buf[80];
- ldout(msgr->cct,0) << "accepter.bind unable to bind to " << bind_addr.ss_addr()
+ ldout(msgr->cct,0) << "accepter.bind unable to bind to " << listen_addr.ss_addr()
<< ": " << strerror_r(errno, buf, sizeof(buf)) << dendl;
- cerr << "accepter.bind unable to bind to " << bind_addr.ss_addr()
+ cerr << "accepter.bind unable to bind to " << listen_addr.ss_addr()
<< ": " << strerror_r(errno, buf, sizeof(buf)) << std::endl;
return -errno;
}
}
if (rc < 0) {
char buf[80];
- ldout(msgr->cct,0) << "accepter.bind unable to bind to " << bind_addr.ss_addr()
+ ldout(msgr->cct,0) << "accepter.bind unable to bind to " << listen_addr.ss_addr()
<< " on any port in range " << CEPH_PORT_START << "-" << CEPH_PORT_LAST
<< ": " << strerror_r(errno, buf, sizeof(buf)) << dendl;
- cerr << "accepter.bind unable to bind to " << bind_addr.ss_addr()
+ cerr << "accepter.bind unable to bind to " << listen_addr.ss_addr()
<< " on any port in range " << CEPH_PORT_START << "-" << CEPH_PORT_LAST
<< ": " << strerror_r(errno, buf, sizeof(buf)) << std::endl;
return -errno;
void *entry();
void stop();
- int bind(entity_addr_t &bind_addr, int avoid_port1=0, int avoid_port2=0);
+ int bind(const entity_addr_t &bind_addr, int avoid_port1=0, int avoid_port2=0);
int rebind(int avoid_port);
int start();
};
* @return 0 on success, or -1 on error, or -errno if
* we can be more specific about the failure.
*/
- virtual int bind(entity_addr_t bind_addr) = 0;
+ virtual int bind(const entity_addr_t& bind_addr) = 0;
/**
* This is an optional function for implementations
* to override. For those implementations that do
* @return 0 on success, or -1 if the SimpleMessenger is already running, or
* -errno if an error is returned from a system call.
*/
- int bind(entity_addr_t bind_addr);
+ int bind(const entity_addr_t& bind_addr);
/**
* This function performs a full restart of the SimpleMessenger. It
* calls mark_down_all() and binds to a new port. (If avoid_port