Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/lavabit/magma.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLadar Levison <ladar@lavabit.com>2017-06-27 22:21:27 +0300
committerLadar Levison <ladar@lavabit.com>2017-06-27 22:21:27 +0300
commit304150433166b70dbf41386c00be2192348883df (patch)
treeb6dfea9a0a952bb4b4fd3795966265c9ecedba1f
parent3ab5ab3fed807e35b21f0528956671673afce09e (diff)
Handle non-errors.fix/networking-code-cleanup
-rw-r--r--src/core/host/tcp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/host/tcp.c b/src/core/host/tcp.c
index 75070131..dc8a360f 100644
--- a/src/core/host/tcp.c
+++ b/src/core/host/tcp.c
@@ -88,9 +88,10 @@ int tcp_continue(int sockd, int result, int syserror) {
if (!status()) return -1;
// Data was processed, so there is no need to retry the operation.
- else if (result >= 0) return result;
+ else if (result > 0) return result;
- else if (result < 0 && (syserror == EWOULDBLOCK || syserror == EAGAIN || syserror == EINTR)) return 0;
+ // Handle non-errors.
+ else if (result <= 0 && (syserror == 0 || syserror == EWOULDBLOCK || syserror == EAGAIN || syserror == EINTR)) return 0;
log_pedantic("A TCP error occurred. { errno = %i / error = %s / message = %s }", syserror, errno_name(syserror),
strerror_r(syserror, message, 1024));