Merge pull request #10297 from Yan-waller/yj-wip-msgsimple-0714

msg/simple: save the errno in case being changed by subsequent codes

Reviewed-by: Loic Dachary <ldachary@redhat.com>
This commit is contained in:
Kefu Chai 2016-11-28 11:07:54 +08:00 committed by GitHub
commit c2782aaaf8

View File

@ -893,7 +893,8 @@ void Pipe::set_socket_options()
int r = ::setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, sizeof(flag));
if (r < 0) {
r = -errno;
ldout(msgr->cct,0) << "couldn't set TCP_NODELAY: " << cpp_strerror(r) << dendl;
ldout(msgr->cct,0) << "couldn't set TCP_NODELAY: "
<< cpp_strerror(r) << dendl;
}
}
if (msgr->cct->_conf->ms_tcp_rcvbuf) {
@ -901,7 +902,8 @@ void Pipe::set_socket_options()
int r = ::setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (void*)&size, sizeof(size));
if (r < 0) {
r = -errno;
ldout(msgr->cct,0) << "couldn't set SO_RCVBUF to " << size << ": " << cpp_strerror(r) << dendl;
ldout(msgr->cct,0) << "couldn't set SO_RCVBUF to " << size
<< ": " << cpp_strerror(r) << dendl;
}
}
@ -911,7 +913,8 @@ void Pipe::set_socket_options()
int r = ::setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, (void*)&val, sizeof(val));
if (r) {
r = -errno;
ldout(msgr->cct,0) << "couldn't set SO_NOSIGPIPE: " << cpp_strerror(r) << dendl;
ldout(msgr->cct,0) << "couldn't set SO_NOSIGPIPE: "
<< cpp_strerror(r) << dendl;
}
#endif
@ -922,8 +925,9 @@ void Pipe::set_socket_options()
int iptos = IPTOS_CLASS_CS6;
r = ::setsockopt(sd, IPPROTO_IP, IP_TOS, &iptos, sizeof(iptos));
if (r < 0) {
r = -errno;
ldout(msgr->cct,0) << "couldn't set IP_TOS to " << iptos
<< ": " << cpp_strerror(errno) << dendl;
<< ": " << cpp_strerror(r) << dendl;
}
#endif
#if defined(SO_PRIORITY)
@ -934,8 +938,9 @@ void Pipe::set_socket_options()
r = ::setsockopt(sd, SOL_SOCKET, SO_PRIORITY, &prio, sizeof(prio));
#endif
if (r < 0) {
r = -errno;
ldout(msgr->cct,0) << "couldn't set SO_PRIORITY to " << prio
<< ": " << cpp_strerror(errno) << dendl;
<< ": " << cpp_strerror(r) << dendl;
}
#endif
}