Commit c0197c58 authored by Max Kellermann's avatar Max Kellermann

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_".
parent 6d18e000
...@@ -234,7 +234,7 @@ static void client_close(struct client *client) ...@@ -234,7 +234,7 @@ static void client_close(struct client *client)
SECURE("client %i: closed\n", client->num); 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; unsigned int i;
...@@ -476,7 +476,7 @@ static void closeNextErroredInterface(void) ...@@ -476,7 +476,7 @@ static void closeNextErroredInterface(void)
} }
} }
int doIOForInterfaces(void) int client_manager_io(void)
{ {
fd_set rfds; fd_set rfds;
fd_set wfds; fd_set wfds;
...@@ -535,7 +535,7 @@ int doIOForInterfaces(void) ...@@ -535,7 +535,7 @@ int doIOForInterfaces(void)
return 1; return 1;
} }
void initInterfaces(void) void client_manager_init(void)
{ {
unsigned int i; unsigned int i;
char *test; char *test;
...@@ -613,7 +613,7 @@ static void client_close_all(void) ...@@ -613,7 +613,7 @@ static void client_close_all(void)
free(list_cache); free(list_cache);
} }
void freeAllInterfaces(void) void client_manager_deinit(void)
{ {
client_close_all(); client_close_all();
...@@ -622,7 +622,7 @@ void freeAllInterfaces(void) ...@@ -622,7 +622,7 @@ void freeAllInterfaces(void)
client_max_connections = 0; client_max_connections = 0;
} }
void closeOldInterfaces(void) void client_manager_expire(void)
{ {
unsigned int i; unsigned int i;
...@@ -688,7 +688,7 @@ static void client_write_deferred(struct client *client) ...@@ -688,7 +688,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; static unsigned int i;
size_t copylen; size_t copylen;
......
...@@ -21,12 +21,12 @@ ...@@ -21,12 +21,12 @@
#include "os_compat.h" #include "os_compat.h"
void initInterfaces(void); void client_manager_init(void);
void openAInterface(int fd, const struct sockaddr *addr); void client_new(int fd, const struct sockaddr *addr);
void freeAllInterfaces(void); void client_manager_deinit(void);
void closeOldInterfaces(void); void client_manager_expire(void);
int interfacePrintWithFD(int fd, const char *buffer, size_t len); int client_print(int fd, const char *buffer, size_t len);
int doIOForInterfaces(void); int client_manager_io(void);
#endif #endif
...@@ -177,7 +177,7 @@ int updateInit(int fd, List * pathList) ...@@ -177,7 +177,7 @@ int updateInit(int fd, List * pathList)
finishSigHandlers(); finishSigHandlers();
closeAllListenSockets(); closeAllListenSockets();
freeAllInterfaces(); client_manager_deinit();
finishPlaylist(); finishPlaylist();
finishVolume(); finishVolume();
......
...@@ -297,7 +297,7 @@ void getConnections(fd_set * fds) ...@@ -297,7 +297,7 @@ void getConnections(fd_set * fds)
if (FD_ISSET(listenSockets[i], fds)) { if (FD_ISSET(listenSockets[i], fds)) {
if ((fd = accept(listenSockets[i], &sockAddr, &socklen)) if ((fd = accept(listenSockets[i], &sockAddr, &socklen))
>= 0) { >= 0) {
openAInterface(fd, &sockAddr); client_new(fd, &sockAddr);
} else if (fd < 0 } else if (fd < 0
&& (errno != EAGAIN && errno != EINTR)) { && (errno != EAGAIN && errno != EINTR)) {
ERROR("Problems accept()'ing\n"); ERROR("Problems accept()'ing\n");
......
...@@ -422,7 +422,7 @@ int main(int argc, char *argv[]) ...@@ -422,7 +422,7 @@ int main(int argc, char *argv[])
initAudioConfig(); initAudioConfig();
initAudioDriver(); initAudioDriver();
initVolume(); initVolume();
initInterfaces(); client_manager_init();
initReplayGainState(); initReplayGainState();
initNormalization(); initNormalization();
initInputStream(); initInputStream();
...@@ -441,17 +441,17 @@ int main(int argc, char *argv[]) ...@@ -441,17 +441,17 @@ int main(int argc, char *argv[])
player_create(); player_create();
read_state_file(); read_state_file();
while (COMMAND_RETURN_KILL != doIOForInterfaces() && while (COMMAND_RETURN_KILL != client_manager_io() &&
COMMAND_RETURN_KILL != handlePendingSignals()) { COMMAND_RETURN_KILL != handlePendingSignals()) {
syncPlayerAndPlaylist(); syncPlayerAndPlaylist();
closeOldInterfaces(); client_manager_expire();
readDirectoryDBIfUpdateIsFinished(); readDirectoryDBIfUpdateIsFinished();
} }
write_state_file(); write_state_file();
playerKill(); playerKill();
finishZeroconf(); finishZeroconf();
freeAllInterfaces(); client_manager_deinit();
closeAllListenSockets(); closeAllListenSockets();
finishPlaylist(); finishPlaylist();
......
...@@ -49,7 +49,7 @@ void vfdprintf(const int fd, const char *fmt, va_list args) ...@@ -49,7 +49,7 @@ void vfdprintf(const int fd, const char *fmt, va_list args)
len = strlen(buf); len = strlen(buf);
if (fd == STDERR_FILENO || if (fd == STDERR_FILENO ||
fd == STDOUT_FILENO || fd == STDOUT_FILENO ||
interfacePrintWithFD(fd, buf, len) < 0) client_print(fd, buf, len) < 0)
blockingWrite(fd, buf, len); blockingWrite(fd, buf, len);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment