Remove strerror(3) from code which may run in multi-thread
This commit is contained in:
parent
e0af8900bf
commit
dbb0df5c5b
|
@ -67,14 +67,14 @@ void ListenHandler::create_worker_thread(size_t num)
|
||||||
WorkerInfo *info = &workers_[num_worker_];
|
WorkerInfo *info = &workers_[num_worker_];
|
||||||
rv = socketpair(AF_UNIX, SOCK_STREAM, 0, info->sv);
|
rv = socketpair(AF_UNIX, SOCK_STREAM, 0, info->sv);
|
||||||
if(rv == -1) {
|
if(rv == -1) {
|
||||||
LLOG(ERROR, this) << "socketpair() failed: " << strerror(errno);
|
LLOG(ERROR, this) << "socketpair() failed: errno=" << errno;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
info->sv_ssl_ctx = sv_ssl_ctx_;
|
info->sv_ssl_ctx = sv_ssl_ctx_;
|
||||||
info->cl_ssl_ctx = cl_ssl_ctx_;
|
info->cl_ssl_ctx = cl_ssl_ctx_;
|
||||||
rv = pthread_create(&thread, &attr, start_threaded_worker, info);
|
rv = pthread_create(&thread, &attr, start_threaded_worker, info);
|
||||||
if(rv != 0) {
|
if(rv != 0) {
|
||||||
LLOG(ERROR, this) << "pthread_create() failed: " << strerror(rv);
|
LLOG(ERROR, this) << "pthread_create() failed: errno=" << rv;
|
||||||
for(size_t j = 0; j < 2; ++j) {
|
for(size_t j = 0; j < 2; ++j) {
|
||||||
close(info->sv[j]);
|
close(info->sv[j]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ int SpdySession::init_notification()
|
||||||
int sockpair[2];
|
int sockpair[2];
|
||||||
rv = socketpair(AF_UNIX, SOCK_STREAM, 0, sockpair);
|
rv = socketpair(AF_UNIX, SOCK_STREAM, 0, sockpair);
|
||||||
if(rv == -1) {
|
if(rv == -1) {
|
||||||
SSLOG(FATAL, this) << "socketpair() failed: " << strerror(errno);
|
SSLOG(FATAL, this) << "socketpair() failed: errno=" << errno;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
wrbev_ = bufferevent_socket_new(evbase_, sockpair[0],
|
wrbev_ = bufferevent_socket_new(evbase_, sockpair[0],
|
||||||
|
@ -258,8 +258,8 @@ void eventcb(bufferevent *bev, short events, void *ptr)
|
||||||
int val = 1;
|
int val = 1;
|
||||||
if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
|
if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
|
||||||
reinterpret_cast<char *>(&val), sizeof(val)) == -1) {
|
reinterpret_cast<char *>(&val), sizeof(val)) == -1) {
|
||||||
SSLOG(WARNING, spdy) << "Setting option TCP_NODELAY failed: "
|
SSLOG(WARNING, spdy) << "Setting option TCP_NODELAY failed: errno="
|
||||||
<< strerror(errno);
|
<< errno;
|
||||||
}
|
}
|
||||||
} else if(events & BEV_EVENT_EOF) {
|
} else if(events & BEV_EVENT_EOF) {
|
||||||
if(LOG_ENABLED(INFO)) {
|
if(LOG_ENABLED(INFO)) {
|
||||||
|
|
|
@ -518,8 +518,8 @@ void spdy_downstream_eventcb(bufferevent *bev, short events, void *ptr)
|
||||||
int val = 1;
|
int val = 1;
|
||||||
if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
|
if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
|
||||||
reinterpret_cast<char *>(&val), sizeof(val)) == -1) {
|
reinterpret_cast<char *>(&val), sizeof(val)) == -1) {
|
||||||
DCLOG(WARNING, dconn) << "Setting option TCP_NODELAY failed: "
|
DCLOG(WARNING, dconn) << "Setting option TCP_NODELAY failed: errno="
|
||||||
<< strerror(errno);
|
<< errno;
|
||||||
}
|
}
|
||||||
} else if(events & BEV_EVENT_EOF) {
|
} else if(events & BEV_EVENT_EOF) {
|
||||||
if(LOG_ENABLED(INFO)) {
|
if(LOG_ENABLED(INFO)) {
|
||||||
|
|
|
@ -261,8 +261,8 @@ ClientHandler* accept_connection(event_base *evbase, SSL_CTX *ssl_ctx,
|
||||||
rv = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
|
rv = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
|
||||||
reinterpret_cast<char *>(&val), sizeof(val));
|
reinterpret_cast<char *>(&val), sizeof(val));
|
||||||
if(rv == -1) {
|
if(rv == -1) {
|
||||||
LOG(WARNING) << "Setting option TCP_NODELAY failed: "
|
LOG(WARNING) << "Setting option TCP_NODELAY failed: errno="
|
||||||
<< strerror(errno);
|
<< errno;
|
||||||
}
|
}
|
||||||
SSL *ssl = 0;
|
SSL *ssl = 0;
|
||||||
bufferevent *bev;
|
bufferevent *bev;
|
||||||
|
|
Loading…
Reference in New Issue