diff options
author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2009-01-06 11:00:44 -0300 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-01-12 20:35:17 +0100 |
commit | f325786f539bf500e4b1e2f209317ef0947d7136 (patch) | |
tree | d2b6de3e127e4447bfb860b4d6ecb604ef039e25 /src/modules | |
parent | 49147c9dab20fddd486e7b4f3dbbd358d3981eab (diff) |
Fix send and recv message sizes.
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/bluetooth/module-bluetooth-device.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 492ee203..2546c694 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -123,11 +123,13 @@ static const char* const valid_modargs[] = { static int bt_audioservice_send(int sk, const bt_audio_msg_header_t *msg) { int e; const char *type, *name; + uint16_t length; + length = msg->length ? msg->length : BT_SUGGESTED_BUFFER_SIZE; type = bt_audio_strtype(msg->type); name = bt_audio_strname(msg->name); pa_log_debug("sending: %s -> %s", type, name); - if (send(sk, msg, msg->length, 0) > 0) + if (send(sk, msg, length, 0) > 0) e = 0; else { e = -errno; @@ -139,9 +141,12 @@ static int bt_audioservice_send(int sk, const bt_audio_msg_header_t *msg) { static int bt_audioservice_recv(int sk, bt_audio_msg_header_t *inmsg, uint16_t expected_length) { int e; const char *type, *name; + uint16_t length; + + length = expected_length ? expected_length : BT_SUGGESTED_BUFFER_SIZE; pa_log_debug("trying to receive msg from audio service..."); - if (recv(sk, inmsg, expected_length ? : BT_SUGGESTED_BUFFER_SIZE, 0) > 0) { + if (recv(sk, inmsg, length, 0) > 0) { type = bt_audio_strtype(inmsg->type); name = bt_audio_strname(inmsg->name); if (type && name) { |