summaryrefslogtreecommitdiffstats
path: root/bchannel.c
diff options
context:
space:
mode:
authorPeter Schlaile2009-03-09 09:25:26 +0100
committerroot2009-03-09 09:25:26 +0100
commitadc5448774e3ab9987955d15bcd92ab9dcca28f1 (patch)
tree2feecaff2fecca55df3b4200b1ff524d5900926a /bchannel.c
parentadded documentation for re-buffer option (diff)
downloadlcr-adc5448774e3ab9987955d15bcd92ab9dcca28f1.tar.gz
lcr-adc5448774e3ab9987955d15bcd92ab9dcca28f1.tar.xz
lcr-adc5448774e3ab9987955d15bcd92ab9dcca28f1.zip
simplified rebuffer-mode to make large block sizes work better
Thanks to Kristijan Vrban for the patch!
Diffstat (limited to 'bchannel.c')
-rw-r--r--bchannel.c47
1 files changed, 4 insertions, 43 deletions
diff --git a/bchannel.c b/bchannel.c
index 473de82..e5d2289 100644
--- a/bchannel.c
+++ b/bchannel.c
@@ -210,7 +210,6 @@ void bchannel_activate(struct bchannel *bchannel, int activate)
CERROR(bchannel->call, NULL, "Failed to send to socket %d\n", bchannel->b_sock);
bchannel->b_state = (activate)?BSTATE_ACTIVATING:BSTATE_DEACTIVATING;
- bchannel->rebuffer_usage = 0;
}
@@ -265,7 +264,6 @@ void bchannel_destroy(struct bchannel *bchannel)
{
close(bchannel->b_sock);
bchannel->b_sock = -1;
- bchannel->rebuffer_usage = 0;
}
bchannel->b_state = BSTATE_IDLE;
}
@@ -390,52 +388,15 @@ static void bchannel_receive(struct bchannel *bchannel, unsigned char *buffer, i
}
}
- /* no hdlc and rebuffer */
- if (bchannel->call->rebuffer && !bchannel->call->hdlc) {
- int u = bchannel->rebuffer_usage;
- unsigned char * b = bchannel->rebuffer;
- int l = len;
- int fd = bchannel->call->pipe[1];
-
- d = data;
-
- if (u > 0) {
- if (u + l >= 160) {
- memcpy(b + u, d, 160 - u);
- d += 160 - u;
- l -= 160 - u;
- u = 0;
- if (write(fd, b, 160) < 0)
- goto errout;
- } else {
- memcpy(b + u, d, l);
- u += l;
- l = 0;
- }
- }
-
- while (l >= 160) {
- if (write(fd, d, 160) < 0)
- goto errout;
- d += 160;
- l -= 160;
- }
-
- if (l > 0) {
- memcpy(b, d, l);
- }
- bchannel->rebuffer_usage = u + l;
- } else {
- len = write(bchannel->call->pipe[1], data, len);
- if (len < 0)
- goto errout;
- }
+
+ len = write(bchannel->call->pipe[1], data, len);
+ if (len < 0)
+ goto errout;
return;
errout:
close(bchannel->call->pipe[1]);
bchannel->call->pipe[1] = -1;
- bchannel->rebuffer_usage = 0;
CDEBUG(bchannel->call, NULL, "broken pipe on bchannel pipe\n");
}