summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-03-25 01:17:56 +0100
committerLennart Poettering <lennart@poettering.net>2009-03-25 01:17:56 +0100
commitfdbe0543be395b7baa4b8228a035529135b8b4c1 (patch)
treee2fd7452cffa9032f5c98b4040ff08d22ce10015 /src/modules
parent98a5f4a9919c67792f3bbf01ee5ed7e666b8b216 (diff)
initialize max_request to SO_SNDBUF
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/module-esound-sink.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/modules/module-esound-sink.c b/src/modules/module-esound-sink.c
index 2b45e302..a27de4c3 100644
--- a/src/modules/module-esound-sink.c
+++ b/src/modules/module-esound-sink.c
@@ -354,6 +354,9 @@ static int do_write(struct userdata *u) {
}
if (!u->write_data && u->state == STATE_PREPARE) {
+ int so_sndbuf = 0;
+ socklen_t sl = sizeof(int);
+
/* OK, we're done with sending all control data we need to, so
* let's hand the socket over to the IO thread now */
@@ -366,6 +369,13 @@ static int do_write(struct userdata *u) {
pa_make_tcp_socket_low_delay(u->fd);
+ if (getsockopt(u->fd, SOL_SOCKET, SO_SNDBUF, &so_sndbuf, &sl) < 0)
+ pa_log_warn("getsockopt(SO_SNDBUF) failed: %s", pa_cstrerror(errno));
+ else {
+ pa_log_debug("SO_SNDBUF is %zu.", (size_t) so_sndbuf);
+ pa_sink_set_max_request(u->sink, PA_MAX((size_t) so_sndbuf, u->block_size));
+ }
+
pa_log_debug("Connection authenticated, handing fd to IO thread...");
pa_asyncmsgq_post(u->thread_mq.inq, PA_MSGOBJECT(u->sink), SINK_MESSAGE_PASS_SOCKET, NULL, 0, NULL, NULL);