return 0;
}
+static unsigned int max_client(struct client *clients[5])
+{
+ unsigned int i, ret = 0;
+
+ for (i = 0; i < 5; i++) {
+ if (clients[i])
+ ret = i+1;
+ }
+ return ret;
+}
+
static void add_client(struct tevent_context *ev,
struct tevent_fd *fde, uint16_t flags, void *_oserver)
{
/* Full? Stop listening... */
if (client->id == ARRAY_SIZE(oserver->clients)-1)
tevent_fd_set_flags(oserver->fde, 0);
+ oserver->max_clients = max_client(oserver->clients);
}
static void clear_clients(struct oserver *oserver)
static bool complete_server(struct tevent_context *ev,
struct oserver *oserver, const char *dumpfile)
{
+ oserver->max_clients = max_client(oserver->clients);
+
/* Re-set this even if restored from file, in case it changed. */
oserver->dumpfile = dumpfile;
if (oserver->dumpfile)
};
CDUMP_SAVED struct oserver {
+ unsigned int max_clients;
/* 5 clients should be enough for anybody! */
struct client *clients[5];
int fd;