Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msg/simple/Pipe:the returned value for do_recv unequal to zero #10272

Merged
merged 1 commit into from Mar 13, 2017

Conversation

yonghengdexin735
Copy link
Contributor

@yonghengdexin735 yonghengdexin735 commented Jul 13, 2016

the returned value for do_recv unequal to zero:

ssize_t Pipe::do_recv(char *buf, size_t len, int flags)
{
again:
  ssize_t got = ::recv( sd, buf, len, flags );
  if (got < 0) {
    if (errno == EINTR) {
      goto again;
    }
    ldout(msgr->cct, 10) << **func** << " socket " << sd << " returned "
             << got << " " << cpp_strerror(errno) << dendl;
    return -1;
  }
  if (got == 0) {
    return -1;
  }
  return got;
}

so here '=' can be removed
Signed-off-by: zhang.zezhu zhang.zezhu@zte.com.cn

@gregsfortytwo
Copy link
Member

Is do_recv() not returning 0 really part of the defined interface, or just a current implementation? I guess we can merge this on the first but the <= doesn't cost any more than < and changing it reduces resiliency to future changes...

@ghost
Copy link

ghost commented Nov 21, 2016

jenkins test this please (jenkins stuck)

@yonghengdexin735
Copy link
Contributor Author

@dachary done

@ghost ghost added the cleanup label Nov 23, 2016
@ghost
Copy link

ghost commented Nov 23, 2016

@yonghengdexin735 you need to update the commit message, it won't work if you update the github web interface message

the returned value for do_recv unequal to zero:

ssize_t Pipe::do_recv(char *buf, size_t len, int flags)
{
again:
  ssize_t got = ::recv( sd, buf, len, flags );
  if (got < 0) {
    if (errno == EINTR) {
      goto again;
    }
    ldout(msgr->cct, 10) << **func** << " socket " << sd << " returned "
             << got << " " << cpp_strerror(errno) << dendl;
    return -1;
  }
  if (got == 0) {
    return -1;
  }
  return got;
}

so here '=' can be removed

Signed-off-by: zhang.zezhu <zhang.zezhu@zte.com.cn>
@yonghengdexin735
Copy link
Contributor Author

@dachary Thank you for review.Done it.

@ghost
Copy link

ghost commented Nov 24, 2016

jenkins test this please (cephtool-test-mds.sh http://tracker.ceph.com/issues/18016)

@tchaikov
Copy link
Contributor

tchaikov commented Mar 7, 2017

i think it's more consistent with the other caller site of do_recv() in Pipe::buffered_recv(). so lgtm.

@yuriw yuriw merged commit b198061 into ceph:master Mar 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants