mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 09:58:17 +00:00
Fixed a problem in FAX where a received handshake, delayed so much it is
received as we queue a retry, causes the retry frame to remain queued in the HDLC entity.
This commit is contained in:
@@ -119,8 +119,8 @@ SPAN_DECLARE(int) queue_view(queue_state_t *s, uint8_t *buf, int len)
|
||||
/* A two step process */
|
||||
if (buf)
|
||||
{
|
||||
memcpy(buf, s->data + optr, to_end);
|
||||
memcpy(buf + to_end, s->data, real_len - to_end);
|
||||
memcpy(buf, &s->data[optr], to_end);
|
||||
memcpy(&buf[to_end], s->data, real_len - to_end);
|
||||
}
|
||||
/*endif*/
|
||||
}
|
||||
@@ -128,7 +128,7 @@ SPAN_DECLARE(int) queue_view(queue_state_t *s, uint8_t *buf, int len)
|
||||
{
|
||||
/* A one step process */
|
||||
if (buf)
|
||||
memcpy(buf, s->data + optr, real_len);
|
||||
memcpy(buf, &s->data[optr], real_len);
|
||||
/*endif*/
|
||||
}
|
||||
/*endif*/
|
||||
@@ -170,8 +170,8 @@ SPAN_DECLARE(int) queue_read(queue_state_t *s, uint8_t *buf, int len)
|
||||
/* A two step process */
|
||||
if (buf)
|
||||
{
|
||||
memcpy(buf, s->data + optr, to_end);
|
||||
memcpy(buf + to_end, s->data, real_len - to_end);
|
||||
memcpy(buf, &s->data[optr], to_end);
|
||||
memcpy(&buf[to_end], s->data, real_len - to_end);
|
||||
}
|
||||
/*endif*/
|
||||
new_optr = real_len - to_end;
|
||||
@@ -180,7 +180,7 @@ SPAN_DECLARE(int) queue_read(queue_state_t *s, uint8_t *buf, int len)
|
||||
{
|
||||
/* A one step process */
|
||||
if (buf)
|
||||
memcpy(buf, s->data + optr, real_len);
|
||||
memcpy(buf, &s->data[optr], real_len);
|
||||
/*endif*/
|
||||
new_optr = optr + real_len;
|
||||
if (new_optr >= s->len)
|
||||
@@ -253,7 +253,7 @@ SPAN_DECLARE(int) queue_write(queue_state_t *s, const uint8_t *buf, int len)
|
||||
if (iptr < optr || to_end >= real_len)
|
||||
{
|
||||
/* A one step process */
|
||||
memcpy(s->data + iptr, buf, real_len);
|
||||
memcpy(&s->data[iptr], buf, real_len);
|
||||
new_iptr = iptr + real_len;
|
||||
if (new_iptr >= s->len)
|
||||
new_iptr = 0;
|
||||
@@ -262,8 +262,8 @@ SPAN_DECLARE(int) queue_write(queue_state_t *s, const uint8_t *buf, int len)
|
||||
else
|
||||
{
|
||||
/* A two step process */
|
||||
memcpy(s->data + iptr, buf, to_end);
|
||||
memcpy(s->data, buf + to_end, real_len - to_end);
|
||||
memcpy(&s->data[iptr], buf, to_end);
|
||||
memcpy(s->data, &buf[to_end], real_len - to_end);
|
||||
new_iptr = real_len - to_end;
|
||||
}
|
||||
/*endif*/
|
||||
@@ -367,8 +367,8 @@ SPAN_DECLARE(int) queue_write_msg(queue_state_t *s, const uint8_t *buf, int len)
|
||||
if (iptr < optr || to_end >= real_len)
|
||||
{
|
||||
/* A one step process */
|
||||
memcpy(s->data + iptr, &lenx, sizeof(uint16_t));
|
||||
memcpy(s->data + iptr + sizeof(uint16_t), buf, len);
|
||||
memcpy(&s->data[iptr], &lenx, sizeof(uint16_t));
|
||||
memcpy(&s->data[iptr + sizeof(uint16_t)], buf, len);
|
||||
new_iptr = iptr + real_len;
|
||||
if (new_iptr >= s->len)
|
||||
new_iptr = 0;
|
||||
@@ -380,16 +380,16 @@ SPAN_DECLARE(int) queue_write_msg(queue_state_t *s, const uint8_t *buf, int len)
|
||||
if (to_end >= sizeof(uint16_t))
|
||||
{
|
||||
/* The actual message wraps around the end of the buffer */
|
||||
memcpy(s->data + iptr, &lenx, sizeof(uint16_t));
|
||||
memcpy(s->data + iptr + sizeof(uint16_t), buf, to_end - sizeof(uint16_t));
|
||||
memcpy(s->data, buf + to_end - sizeof(uint16_t), real_len - to_end);
|
||||
memcpy(&s->data[iptr], &lenx, sizeof(uint16_t));
|
||||
memcpy(&s->data[iptr + sizeof(uint16_t)], buf, to_end - sizeof(uint16_t));
|
||||
memcpy(s->data, &buf[to_end - sizeof(uint16_t)], real_len - to_end);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The message length wraps around the end of the buffer */
|
||||
memcpy(s->data + iptr, (uint8_t *) &lenx, to_end);
|
||||
memcpy(&s->data[iptr], (uint8_t *) &lenx, to_end);
|
||||
memcpy(s->data, ((uint8_t *) &lenx) + to_end, sizeof(uint16_t) - to_end);
|
||||
memcpy(s->data + sizeof(uint16_t) - to_end, buf, len);
|
||||
memcpy(&s->data[sizeof(uint16_t) - to_end], buf, len);
|
||||
}
|
||||
new_iptr = real_len - to_end;
|
||||
}
|
||||
|
Reference in New Issue
Block a user