You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Alan Conway (JIRA)" <ji...@apache.org> on 2016/07/19 15:38:20 UTC
[jira] [Resolved] (PROTON-1165) qpid proton cpp binding
posix/io.cpp tests wrong error condition
[ https://issues.apache.org/jira/browse/PROTON-1165?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alan Conway resolved PROTON-1165.
---------------------------------
Resolution: Fixed
This was indeed a bug, but the socket_engine was removed in 0.13. I have checked the code to ensure the bug was not cut/paste elsewhere. Currently the epoll_container.cpp example code shows how to do this correctly.
> qpid proton cpp binding posix/io.cpp tests wrong error condition
> ----------------------------------------------------------------
>
> Key: PROTON-1165
> URL: https://issues.apache.org/jira/browse/PROTON-1165
> Project: Qpid Proton
> Issue Type: Bug
> Components: cpp-binding
> Affects Versions: 0.12.0
> Environment: linux/posix
> Reporter: Roman Puls
> Assignee: Alan Conway
> Labels: patch
> Fix For: 0.14.0
>
>
> posix/io.cpp:
> size_t socket_engine::io_write(const char *buf, size_t size) {
> ssize_t n = ::write(socket_, buf, size);
> if (n == EAGAIN || n == EWOULDBLOCK) return 0;
> if (n < 0) check(n, "write: ");
> return n;
> }
> instead of testing n against EAGAIN/EWOULDBLOCK, n needs to be tested against -1 and then errno needs to be compared to EAGAIN/EWOULDBLOCK
> proposed fix:
> size_t socket_engine::io_write(const char *buf, size_t size) {
> ssize_t n = ::write(socket_, buf, size);
> if (n < 0) {
> if (errno == EAGAIN || errno == EWOULDBLOCK) {
> return 0;
> }
> check(n, "write: ");
> }
> return n;
> }
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org