summaryrefslogtreecommitdiffstats
path: root/src/rpc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc.c')
-rw-r--r--src/rpc.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/rpc.c b/src/rpc.c
index 28e4b2e..0689587 100644
--- a/src/rpc.c
+++ b/src/rpc.c
@@ -68,15 +68,17 @@ int rpc_open( void )
return fd;
}
-void rpc_wait( int listenFd, int seconds )
+bool rpc_wait( int listenFd, int seconds )
{
struct pollfd pd[2] = {
{ .fd = listenFd, .events = POLLIN | POLLHUP | POLLRDHUP },
{ .fd = rpcPipe.read, .events = POLLIN | POLLHUP | POLLRDHUP },
};
- if ( poll( pd, 2, seconds * 1000 ) == -1 ) {
+ int ret = poll( pd, 2, seconds * 1000 );
+ if ( ret == -1 ) {
perror( "Error polling RPC sockets" );
}
+ return ret > 0;
}
void rpc_handle( int listenFd )
@@ -167,11 +169,13 @@ static void handleClient( int fd, struct ucred *creds )
// 1) Global state
time_t deadline;
const char *name = "none";
- main_getStatus( &name, &deadline );
+ int userCount;
+ main_getStatus( &name, &deadline, &userCount );
fprintf( s, "[General]\n"
"nextAction=%s\n"
- "nextActionTime=%lld\n",
- name, (long long)deadline );
+ "nextActionTime=%lld\n"
+ "userCount=%d\n",
+ name, (long long)deadline, userCount );
// 2) Requested sessions
char *tok = strtok( buffer + 4, " \t\n\r" );
while ( tok != NULL ) {