msg/async/net_handler.cc: fix unused reference for option

- If no option value is to be supplied or returned,
     optval may be NULL
 - ignore priority options for FreeBSD

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
This commit is contained in:
Willem Jan Withagen 2017-04-25 21:30:56 +02:00
parent 61a87c2c31
commit 9f1e5a92f8

View File

@ -33,7 +33,7 @@ namespace ceph{
int NetHandler::create_socket(int domain, bool reuse_addr)
{
int s, on = 1;
int s;
if ((s = ::socket(domain, SOCK_STREAM, 0)) == -1) {
lderr(cct) << __func__ << " couldn't create socket " << cpp_strerror(errno) << dendl;
@ -44,6 +44,7 @@ int NetHandler::create_socket(int domain, bool reuse_addr)
/* Make sure connection-intensive things like the benchmark
* will be able to close/open sockets a zillion of times */
if (reuse_addr) {
int on = 1;
if (::setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) {
lderr(cct) << __func__ << " setsockopt SO_REUSEADDR failed: "
<< strerror(errno) << dendl;