2
* Utility functions used throughout libdmapsharing
4
* Copyright (C) 2010 W. Michael Petullo <mike@flyn.org>
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2.1 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
#include "dmap-utils.h"
25
#define DMAP_SHARE_CHUNK_SIZE 16384
28
dmap_write_next_chunk (SoupMessage * message, ChunkData * cd)
32
gchar *chunk = g_malloc (DMAP_SHARE_CHUNK_SIZE);
34
read_size = g_input_stream_read (cd->stream,
36
DMAP_SHARE_CHUNK_SIZE, NULL, &error);
38
soup_message_body_append (message->response_body,
39
SOUP_MEMORY_TAKE, chunk, read_size);
42
g_warning ("Error reading from input stream: %s",
47
g_debug ("Wrote 0 bytes, sending message complete.");
48
soup_message_body_complete (message->response_body);
50
soup_server_unpause_message (cd->server, message);
54
dmap_chunked_message_finished (SoupMessage * message, ChunkData * cd)
56
g_debug ("Finished sending chunked file.");
57
g_input_stream_close (cd->stream, NULL, NULL);