Skip to content

Commit

Permalink
Merge pull request ideawu#993 from ideawu/dev
Browse files Browse the repository at this point in the history
update
  • Loading branch information
ideawu authored Sep 27, 2016
2 parents b99e2bf + bdc676e commit d974dbb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
11 changes: 6 additions & 5 deletions src/net/link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,12 @@ Link* Link::accept(){
}
}

// struct linger opt = {1, 0};
// int ret = ::setsockopt(client_sock, SOL_SOCKET, SO_LINGER, (void *)&opt, sizeof(opt));
// if (ret != 0) {
// //log_error("socket %d set linger failed: %s", client_sock, strerror(errno));
// }
// avoid client side TIME_WAIT
struct linger opt = {1, 0};
int ret = ::setsockopt(client_sock, SOL_SOCKET, SO_LINGER, (void *)&opt, sizeof(opt));
if (ret != 0) {
//log_error("socket %d set linger failed: %s", client_sock, strerror(errno));
}

link = new Link();
link->sock = client_sock;
Expand Down
8 changes: 3 additions & 5 deletions src/net/worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ int ProcWorker::proc(ProcJob *job){
if(job->link->send(job->resp.resp) == -1){
job->result = PROC_ERROR;
}else{
if(job->cmd->flags & Command::FLAG_READ){
int len = job->link->write();
if(len < 0){
job->result = PROC_ERROR;
}
int len = job->link->write();
if(len < 0){
job->result = PROC_ERROR;
}
}
return 0;
Expand Down

0 comments on commit d974dbb

Please sign in to comment.