aboutsummaryrefslogtreecommitdiff
path: root/src/client.c
Commit message (Collapse)AuthorAge
* all: Update copyright header.Avuton Olrich2009-03-13
| | | | | | | | 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-28
| | | | | Removed the sockaddr_to_tmp_string() hack, use the new function sockaddr_to_string() instead.
* client: removed duplicate "client" string from logMax Kellermann2009-02-27
| | | | | | | | | | | | | 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-30
| | | | | | 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-25
| | | | | | | | | 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-25
| | | | | 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-25
| | | | | | 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-21
| | | | | Simplify some code by using config_get_positive(), instead of doing manual parsing and validation each time.
* conf: no CamelCase, part IMax Kellermann2009-01-17
| | | | Renamed functions, types, variables.
* client: remove "expire" event on exitMax Kellermann2009-01-10
|
* added missing explicit config.h includesMax Kellermann2009-01-08
|
* client: use GList instead of dlist.hMax Kellermann2009-01-07
| | | | Get rid of the non-portable Linux list library, part I.
* client: use GLib instead of utils.hMax Kellermann2009-01-03
|
* client: convert GREETING to a static stringMax Kellermann2009-01-03
| | | | The length of GREETING is known at compile time, don't use strlen().
* main_notify: renamed source to event_pipe.cMax Kellermann2009-01-01
| | | | | | 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-31
| | | | | | 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-31
| | | | | Remove the event source from the GMainLoop object in client_set_expired().
* main: export the main_loop variableMax Kellermann2008-12-30
| | | | | 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-30
| | | | | | | 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-29
| | | | | 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-29
|
* client: always attempt to flush deferred buffersMax Kellermann2008-12-24
| | | | | | | | | | | 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-02
| | | | | 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-24
|
* command: allow clients to subscribe to specific idle eventsMarc Pavot2008-11-22
| | | | | | 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-31
| | | | Return bool instead of int.
* client: don't try again after partial writeMax Kellermann2008-10-31
| | | | | 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-31
| | | | Another custom data structore converted to GLib.
* client: use GSList instead of struct strnode for command listsMax Kellermann2008-10-31
| | | | Replace a custom data structure with a GLib one.
* client: removed list_cacheMax Kellermann2008-10-31
| | | | | | 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-22
| | | | Eliminate CamelCase in all public and static functions.
* client: converted permissions to unsignedMax Kellermann2008-10-17
| | | | client->permission is a bit set, and should be unsigned.
* client: eliminate variable "left" in client_write()Max Kellermann2008-10-17
| | | | Reduce two temporary variables to only one.
* client: fixed send bufferMax Kellermann2008-10-17
| | | | | 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-17
| | | | | | | 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.
* client: added assertions on the buffer pointersMax Kellermann2008-10-17
| | | | The buffer pointers must not exceed the buffer size.
* client: read() return value is ssize_tMax Kellermann2008-10-17
| | | | Use ssize_t instead of int.
* client: handle partial lines correctlyMax Kellermann2008-10-17
| | | | | | Commit 6eb62e47 didn't obey partial lines correctly: when a line wasn't finished in one read, the first part was ignored when the rest arrived.
* listen, client: enable SO_PASSCRED, get client's uidMax Kellermann2008-10-15
| | | | | Enable authentication over unix sockets. Store the client's uid in the client struct.
* idle: client command "noidle" aborts idleMax Kellermann2008-10-15
|
* client: optimized client_input_received()Max Kellermann2008-10-15
| | | | | | Use memchr() instead of manually traversing the input buffer. Update the client's properties after all commands have been processed. Check for buffer overflow once.
* command: added command "idle"Max Kellermann2008-10-14
| | | | | | "idle" waits until something noteworthy happens on the server, e.g. song change, playlist modified, database updated. This allows clients to keep up to date without polling.
* don't include os_compat.hMax Kellermann2008-10-08
| | | | | When there are standardized headers, use these instead of the bloated os_compat.h.
* client: check expired after client_process_line()Max Kellermann2008-09-17
| | | | | | The assertion on "!client_is_expired(client)" was wrong, because writing the command response may cause the client to become expired. Replace that assertion with a check.
* client: simplified client_read()Max Kellermann2008-09-10
| | | | Remove one comparison by changing branch order.
* client: client_input_received() returns 0Max Kellermann2008-09-10
| | | | | | | | | Since the caller chain doesn't care about the return value (except for COMMAND_RETURN_KILL, COMMAND_RETURN_CLOSE), just return 0 if there is nothing special. This saves one local variable initialization, and one access to it. Also remove one unreachable "return 1" from client_read().
* client: check for COMMAND_RETURN_CLOSEMax Kellermann2008-09-10
| | | | | | | Don't close the client within client_process_line(), return COMMAND_RETURN_CLOSE instead. This is the signal for the caller chain to actually close it. This makes dealing with the client pointer a lot safer, since the caller always knows whether it is still valid.
* client: renamed local variable "selret" to "ret"Max Kellermann2008-09-10
| | | | It's easier to reuse the variable if it has a more generic name.
* client: moved CLOSE/KILL check after client_process_line()Max Kellermann2008-09-10
| | | | Don't update client data if it is going to be closed anyway.
* command: use client_[gs]et_permission()Max Kellermann2008-09-07
| | | | | | Don't pass a pointer to client->permission to processCommand(), better let the code in command.c use the new permission getter/setter functions.