Store sessions in an RB tree by name rather than a list, this is tidier

and allows them to easily be shown sorted in various lists
(list-sessions/choose-sessions).

Keep a session index which is used in a couple of places internally but
make it an ever-increasing number rather than filling in gaps with new
sessions.
This commit is contained in:
Nicholas Marriott
2010-12-21 22:37:59 +00:00
parent 1b8488ee75
commit acf13ce978
12 changed files with 143 additions and 183 deletions

View File

@ -47,7 +47,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
char *overrides, *cause;
u_int i;
if (ARRAY_LENGTH(&sessions) == 0) {
if (RB_EMPTY(&sessions)) {
ctx->error(ctx, "no sessions");
return (-1);
}