1
0
mirror of https://github.com/moparisthebest/spdylay synced 2024-12-21 23:28:52 -05:00

Remove strerror(3) from code which may run in multi-thread

This commit is contained in:
Tatsuhiro Tsujikawa 2013-02-25 22:43:44 +09:00
parent e0af8900bf
commit dbb0df5c5b
4 changed files with 9 additions and 9 deletions

View File

@ -67,14 +67,14 @@ void ListenHandler::create_worker_thread(size_t num)
WorkerInfo *info = &workers_[num_worker_];
rv = socketpair(AF_UNIX, SOCK_STREAM, 0, info->sv);
if(rv == -1) {
LLOG(ERROR, this) << "socketpair() failed: " << strerror(errno);
LLOG(ERROR, this) << "socketpair() failed: errno=" << errno;
continue;
}
info->sv_ssl_ctx = sv_ssl_ctx_;
info->cl_ssl_ctx = cl_ssl_ctx_;
rv = pthread_create(&thread, &attr, start_threaded_worker, info);
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) {
close(info->sv[j]);
}

View File

@ -186,7 +186,7 @@ int SpdySession::init_notification()
int sockpair[2];
rv = socketpair(AF_UNIX, SOCK_STREAM, 0, sockpair);
if(rv == -1) {
SSLOG(FATAL, this) << "socketpair() failed: " << strerror(errno);
SSLOG(FATAL, this) << "socketpair() failed: errno=" << errno;
return -1;
}
wrbev_ = bufferevent_socket_new(evbase_, sockpair[0],
@ -258,8 +258,8 @@ void eventcb(bufferevent *bev, short events, void *ptr)
int val = 1;
if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
reinterpret_cast<char *>(&val), sizeof(val)) == -1) {
SSLOG(WARNING, spdy) << "Setting option TCP_NODELAY failed: "
<< strerror(errno);
SSLOG(WARNING, spdy) << "Setting option TCP_NODELAY failed: errno="
<< errno;
}
} else if(events & BEV_EVENT_EOF) {
if(LOG_ENABLED(INFO)) {

View File

@ -518,8 +518,8 @@ void spdy_downstream_eventcb(bufferevent *bev, short events, void *ptr)
int val = 1;
if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
reinterpret_cast<char *>(&val), sizeof(val)) == -1) {
DCLOG(WARNING, dconn) << "Setting option TCP_NODELAY failed: "
<< strerror(errno);
DCLOG(WARNING, dconn) << "Setting option TCP_NODELAY failed: errno="
<< errno;
}
} else if(events & BEV_EVENT_EOF) {
if(LOG_ENABLED(INFO)) {

View File

@ -261,8 +261,8 @@ ClientHandler* accept_connection(event_base *evbase, SSL_CTX *ssl_ctx,
rv = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
reinterpret_cast<char *>(&val), sizeof(val));
if(rv == -1) {
LOG(WARNING) << "Setting option TCP_NODELAY failed: "
<< strerror(errno);
LOG(WARNING) << "Setting option TCP_NODELAY failed: errno="
<< errno;
}
SSL *ssl = 0;
bufferevent *bev;