From 9cf1bf0671950024a21918335ab82ce9ef24cbf7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 28 Aug 2008 20:03:02 +0200 Subject: client: renamed all public functions Functions which operate on the whole client list are prefixed with "client_manager_", and functions which handle just one client just get "client_". --- src/client.c | 12 ++++++------ src/client.h | 12 ++++++------ src/directory.c | 2 +- src/listen.c | 2 +- src/main.c | 8 ++++---- src/myfprintf.c | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/client.c b/src/client.c index 63595da03..87088e76f 100644 --- a/src/client.c +++ b/src/client.c @@ -234,7 +234,7 @@ static void client_close(struct client *client) SECURE("client %i: closed\n", client->num); } -void openAInterface(int fd, const struct sockaddr *addr) +void client_new(int fd, const struct sockaddr *addr) { unsigned int i; @@ -476,7 +476,7 @@ static void closeNextErroredInterface(void) } } -int doIOForInterfaces(void) +int client_manager_io(void) { fd_set rfds; fd_set wfds; @@ -532,7 +532,7 @@ int doIOForInterfaces(void) return 1; } -void initInterfaces(void) +void client_manager_init(void) { unsigned int i; char *test; @@ -610,7 +610,7 @@ static void client_close_all(void) free(list_cache); } -void freeAllInterfaces(void) +void client_manager_deinit(void) { client_close_all(); @@ -619,7 +619,7 @@ void freeAllInterfaces(void) client_max_connections = 0; } -void closeOldInterfaces(void) +void client_manager_expire(void) { unsigned int i; @@ -685,7 +685,7 @@ static void client_write_deferred(struct client *client) } } -int interfacePrintWithFD(int fd, const char *buffer, size_t buflen) +int client_print(int fd, const char *buffer, size_t buflen) { static unsigned int i; size_t copylen; diff --git a/src/client.h b/src/client.h index c83381319..64639b2af 100644 --- a/src/client.h +++ b/src/client.h @@ -21,12 +21,12 @@ #include "os_compat.h" -void initInterfaces(void); -void openAInterface(int fd, const struct sockaddr *addr); -void freeAllInterfaces(void); -void closeOldInterfaces(void); -int interfacePrintWithFD(int fd, const char *buffer, size_t len); +void client_manager_init(void); +void client_new(int fd, const struct sockaddr *addr); +void client_manager_deinit(void); +void client_manager_expire(void); +int client_print(int fd, const char *buffer, size_t len); -int doIOForInterfaces(void); +int client_manager_io(void); #endif diff --git a/src/directory.c b/src/directory.c index 6f3409356..46d309c76 100644 --- a/src/directory.c +++ b/src/directory.c @@ -177,7 +177,7 @@ int updateInit(int fd, List * pathList) finishSigHandlers(); closeAllListenSockets(); - freeAllInterfaces(); + client_manager_deinit(); finishPlaylist(); finishVolume(); diff --git a/src/listen.c b/src/listen.c index 4adebb66a..c40035279 100644 --- a/src/listen.c +++ b/src/listen.c @@ -297,7 +297,7 @@ void getConnections(fd_set * fds) if (FD_ISSET(listenSockets[i], fds)) { if ((fd = accept(listenSockets[i], &sockAddr, &socklen)) >= 0) { - openAInterface(fd, &sockAddr); + client_new(fd, &sockAddr); } else if (fd < 0 && (errno != EAGAIN && errno != EINTR)) { ERROR("Problems accept()'ing\n"); diff --git a/src/main.c b/src/main.c index 45dc962ce..363359831 100644 --- a/src/main.c +++ b/src/main.c @@ -415,7 +415,7 @@ int main(int argc, char *argv[]) initAudioConfig(); initAudioDriver(); initVolume(); - initInterfaces(); + client_manager_init(); initReplayGainState(); initNormalization(); initInputStream(); @@ -435,17 +435,17 @@ int main(int argc, char *argv[]) decoder_init(); read_state_file(); - while (COMMAND_RETURN_KILL != doIOForInterfaces() && + while (COMMAND_RETURN_KILL != client_manager_io() && COMMAND_RETURN_KILL != handlePendingSignals()) { syncPlayerAndPlaylist(); - closeOldInterfaces(); + client_manager_expire(); readDirectoryDBIfUpdateIsFinished(); } write_state_file(); ob_trigger_action(OB_ACTION_PAUSE_SET); finishZeroconf(); - freeAllInterfaces(); + client_manager_deinit(); closeAllListenSockets(); finishPlaylist(); diff --git a/src/myfprintf.c b/src/myfprintf.c index abb2fdde3..200c80334 100644 --- a/src/myfprintf.c +++ b/src/myfprintf.c @@ -49,7 +49,7 @@ void vfdprintf(const int fd, const char *fmt, va_list args) len = strlen(buf); if (fd == STDERR_FILENO || fd == STDOUT_FILENO || - interfacePrintWithFD(fd, buf, len) < 0) + client_print(fd, buf, len) < 0) blockingWrite(fd, buf, len); } -- cgit v1.2.3