aboutsummaryrefslogtreecommitdiffstats
path: root/src/client.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright notices.Avuton Olrich2009-12-311-1/+1
|
* include config.h in all sourcesMax Kellermann2009-11-121-0/+1
| | | | | | After we've been hit by Large File Support problems several times in the past week (which only occur on 32 bit platforms, which I don't have), this is yet another attempt to fix the issue.
* client: splitted client.c into several piecesMax Kellermann2009-07-281-875/+0
| | | | | The soure file client.c has nearly 1000 lines, time for splitting it into smaller pieces to improve readability.
* client: moved struct client to client_internal.hMax Kellermann2009-07-281-44/+1
| | | | Prepare splitting client.c into several sources.
* client: moved some code to client_list_X()Max Kellermann2009-07-231-13/+51
| | | | Make the client list management a separate sub-library.
* client: don't include socket headersMax Kellermann2009-07-231-10/+0
| | | | | The client code uses portable GLib I/O functions and doesn't need the OS specific socket headers.
* client: return "enum command_return" instead of "int"Max Kellermann2009-07-191-16/+24
| | | | | Several functions work with the wrong return type, this patch fixes them.
* client: check "expired" flag again in client_write_output()Max Kellermann2009-06-041-0/+3
| | | | | | | When client_defer_output() aborts the connection to the client, client_write_output() called client_write_deferred() anyway. This caused an assertion failure. Fix it by checking for the "expired" flag again after client_defer_output() returns.
* client: added assertions on channel!=NULLMax Kellermann2009-06-041-0/+10
| | | | | | I'm hunting down a bug where client->channel==NULL during I/O operations. These new assertions help avoid this kind of bug in the future.
* client: use GTimer to track timeoutsMax Kellermann2009-04-251-7/+14
|
* client: free the fifo bufferMax Kellermann2009-04-171-0/+2
| | | | | This patch fixes a memory leak: the fifo_buffer object was not freed when the client connection was closed.
* client, event_pipe: explicitly ignore the write() resultMax Kellermann2009-04-011-1/+1
| | | | | | | | | | On both locations, the result of write() can be ignored safely. In event_pipe_emit_fast(), that can only be "EAGAIN", which means that the pipe buffer is full - no further notification required. In client_init(), that would be a fatal connection error, which would be caught by the next event. This patch fixes gcc warnings.
* client: group static function declarations together.Avuton Olrich2009-03-301-6/+5
|
* client: client_write() does not necessary for export.Avuton Olrich2009-03-301-1/+4
|
* client: use the new fifo_buffer libraryMax Kellermann2009-03-141-48/+41
|
* all: Update copyright header.Avuton Olrich2009-03-131-6/+7
| | | | | | | | This updates the copyright header to all be the same, which is pretty much an update of where to mail request for a copy of the GPL and the years of the MPD project. This also puts all committers under 'The Music Player Project' umbrella. These entries should go individually in the AUTHORS file, for consistancy.
* client: use sockaddr_to_string()Max Kellermann2009-02-281-45/+7
| | | | | Removed the sockaddr_to_tmp_string() hack, use the new function sockaddr_to_string() instead.
* client: removed duplicate "client" string from logMax Kellermann2009-02-271-14/+14
| | | | | | | | | | | | | Since we introduced a GLib logging domain, the "client" string appears twice in the log lines: client: client 0: command returned 0 Removed the second one, now it looks like this: client: [0] command returned 0 Still not quite good, but better than before.
* client: check for G_IO_ERR and G_IO_HUPMax Kellermann2009-01-301-8/+19
| | | | | | When we do not explicitly catch G_IO_ERR and G_IO_HUP, GLib can go into an infinite loop, because it won't deliver the socket error to MPD.
* client: use the GIOChannel for I/OMax Kellermann2009-01-251-40/+110
| | | | | | | | | GIOChannel is more portable than raw read()/write() calls. We're using GIOChannel anyway, because we need it for plugging the client into the GLib main loop. Configure the GIOChannel to the bare minimum: no character set, no buffering.
* client: use GLib's win32 IO channel on WIN32Max Kellermann2009-01-251-0/+5
| | | | | Use g_io_channel_win32_new_socket() instead of g_io_channel_unix_new() on WIN32.
* use g_free() instead of free()Max Kellermann2009-01-251-3/+3
| | | | | | On some platforms, g_free() must be used for memory allocated by GLib. This patch intends to correct a lot of occurrences, but is probably not complete.
* use config_get_positive() instead of manual parsingMax Kellermann2009-01-211-54/+17
| | | | | Simplify some code by using config_get_positive(), instead of doing manual parsing and validation each time.
* conf: no CamelCase, part IMax Kellermann2009-01-171-5/+5
| | | | Renamed functions, types, variables.
* client: remove "expire" event on exitMax Kellermann2009-01-101-0/+3
|
* added missing explicit config.h includesMax Kellermann2009-01-081-2/+1
|
* client: use GList instead of dlist.hMax Kellermann2009-01-071-37/+47
| | | | Get rid of the non-portable Linux list library, part I.
* client: use GLib instead of utils.hMax Kellermann2009-01-031-7/+8
|
* client: convert GREETING to a static stringMax Kellermann2009-01-031-2/+2
| | | | The length of GREETING is known at compile time, don't use strlen().
* main_notify: renamed source to event_pipe.cMax Kellermann2009-01-011-1/+1
| | | | | | We are going to migrate away from the concept of notifying the main thread. There should be events sent to it instead. This patch starts a series to implement that.
* client: run client_manager_expire() in an idle eventMax Kellermann2008-12-311-1/+22
| | | | | | With the GLib main loop, the client manager can install its own event in case a client is expired. No need for main.c to call client_manager_expire() manually.
* client: remember GLib source idMax Kellermann2008-12-311-9/+14
| | | | | Remove the event source from the GMainLoop object in client_set_expired().
* main: export the main_loop variableMax Kellermann2008-12-301-1/+2
| | | | | Other libraries may need to access the main_loop reference, to add or remove events, or to call g_main_loop_quit().
* main: use the GLib main loopMax Kellermann2008-12-301-68/+71
| | | | | | | This is a rather huge patch, which unfortunately cannot be splitted. Instead of using our custom ioops.h library, convert everything to use the GLib main loop.
* client: include winsock headers on WIN32Max Kellermann2008-12-291-2/+8
| | | | | On Windows, socket declarations reside in winsock.h and ws2tcpip.h. The POSIX headers sys/socket.h etc. are not available.
* client: use GLib loggingMax Kellermann2008-12-291-48/+53
|
* client: always attempt to flush deferred buffersMax Kellermann2008-12-241-2/+11
| | | | | | | | | | | When a response is very long (e.g. a large playlist > 100k songs), most of it will end up in the deferred buffers. Filling the deferred queue is very expensive currently, because a new buffer is allocated for every client_write() operation. This may lead to long delays, and the client might give up and disconnect meanwhile. This patch makes MPD attempt to flush the deferred queue as often as possible, to work around this problem. Due to the MPD 0.14 code freeze, we should not optimize the buffering code now.
* replaced mpd_printf etc by G_GNUC_PRINTFThomas Jansen2008-12-021-1/+1
| | | | | We want to remove gcc.h eventually. This takes care of all the G_GNUC_PRINTF macros.
* client.c: replaced mpd_unused by G_GNUC_UNUSEDThomas Jansen2008-11-241-1/+1
|
* command: allow clients to subscribe to specific idle eventsMarc Pavot2008-11-221-17/+12
| | | | | | The client may provide the names of idle events as arguments to the "idle" command to inform MPD that it is only interested in these events.
* client: use boolMax Kellermann2008-10-311-1/+1
| | | | Return bool instead of int.
* client: don't try again after partial writeMax Kellermann2008-10-311-0/+1
| | | | | After a partial write, chances are vanishing that another write() will succeed. Don't try immediately.
* client: use GQueue instead of sllist.h for deferred_sendMax Kellermann2008-10-311-34/+42
| | | | Another custom data structore converted to GLib.
* client: use GSList instead of struct strnode for command listsMax Kellermann2008-10-311-41/+15
| | | | Replace a custom data structure with a GLib one.
* client: removed list_cacheMax Kellermann2008-10-311-34/+1
| | | | | | The list cache aims to save memory allocations, and complicates the code a bit. We should rather use GLib slices later, which are easy to use.
* command: no CamelCaseMax Kellermann2008-10-221-4/+4
| | | | Eliminate CamelCase in all public and static functions.
* client: converted permissions to unsignedMax Kellermann2008-10-171-3/+3
| | | | client->permission is a bit set, and should be unsigned.
* client: eliminate variable "left" in client_write()Max Kellermann2008-10-171-5/+5
| | | | Reduce two temporary variables to only one.
* client: fixed send bufferMax Kellermann2008-10-171-49/+4
| | | | | There is no sense in using the kernel's send buffer size (SO_SNDBUF) for MPD's send buffer. Convert it into a static buffer of 4 kB.
* client: removed CLIENT_MAX_BUFFER_LENGTHMax Kellermann2008-10-171-3/+2
| | | | | | | Use a literal in the struct declaration, and sizeof(client->buffer) everywhere else. Also shrink the buffer from 40 kB to 4 kB. The buffer must only be large enough to hold one line of input, and 4 kB is still more than enough.