diff options
author | Jay Sorg <jay.sorg@gmail.com> | 2010-10-20 22:46:32 -0700 |
---|---|---|
committer | Jay Sorg <jay.sorg@gmail.com> | 2010-10-20 22:46:32 -0700 |
commit | 368db230613a5dbb3de6f07764845110102ae9f6 (patch) | |
tree | 85d6b05e1cb555c8620768faf1ad575f89ea9b11 | |
parent | 1e8b5ea2cd2415e8c9ca2c5cb36d3d76071f8f76 (diff) | |
download | xrdp-proprietary-368db230613a5dbb3de6f07764845110102ae9f6.tar.gz xrdp-proprietary-368db230613a5dbb3de6f07764845110102ae9f6.zip |
fix for 100% cpu when socket error
-rw-r--r-- | common/trans.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/common/trans.c b/common/trans.c index 681174ac..37e3f211 100644 --- a/common/trans.c +++ b/common/trans.c @@ -114,7 +114,7 @@ trans_check_wait_objs(struct trans* self) { /* error */ self->status = TRANS_STATUS_DOWN; - rv = 1; + return 1; } } if (in_sck != -1) @@ -157,14 +157,14 @@ trans_check_wait_objs(struct trans* self) { /* error */ self->status = TRANS_STATUS_DOWN; - rv = 1; + return 1; } } else if (read_bytes == 0) { /* error */ self->status = TRANS_STATUS_DOWN; - rv = 1; + return 1; } else { @@ -189,14 +189,12 @@ trans_check_wait_objs(struct trans* self) int APP_CC trans_force_read_s(struct trans* self, struct stream* in_s, int size) { - int rv; int rcvd; if (self->status != TRANS_STATUS_UP) { return 1; } - rv = 0; while (size > 0) { rcvd = g_tcp_recv(self->sck, in_s->end, size, 0); @@ -213,14 +211,14 @@ trans_force_read_s(struct trans* self, struct stream* in_s, int size) { /* error */ self->status = TRANS_STATUS_DOWN; - rv = 1; + return 1; } } else if (rcvd == 0) { /* error */ self->status = TRANS_STATUS_DOWN; - rv = 1; + return 1; } else { @@ -228,7 +226,7 @@ trans_force_read_s(struct trans* self, struct stream* in_s, int size) size -= rcvd; } } - return rv; + return 0; } /*****************************************************************************/ @@ -244,14 +242,12 @@ trans_force_write_s(struct trans* self, struct stream* out_s) { int size; int total; - int rv; int sent; if (self->status != TRANS_STATUS_UP) { return 1; } - rv = 0; size = (int)(out_s->end - out_s->data); total = 0; while (total < size) @@ -270,21 +266,21 @@ trans_force_write_s(struct trans* self, struct stream* out_s) { /* error */ self->status = TRANS_STATUS_DOWN; - rv = 1; + return 1; } } else if (sent == 0) { /* error */ self->status = TRANS_STATUS_DOWN; - rv = 1; + return 1; } else { total = total + sent; } } - return rv; + return 0; } /*****************************************************************************/ |