aboutsummaryrefslogtreecommitdiff
path: root/cmd-attach-session.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-01-19 17:16:09 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-01-19 17:16:09 +0000
commit5f6a351df72f76f98ee1ed3494d025fe591fdb69 (patch)
tree263a4fcc0c99484d27bf868e7de753474603906a /cmd-attach-session.c
parent95323a6a3612a155420dbb17b424db14cabcf06d (diff)
downloadrtmux-5f6a351df72f76f98ee1ed3494d025fe591fdb69.tar.gz
rtmux-5f6a351df72f76f98ee1ed3494d025fe591fdb69.tar.bz2
rtmux-5f6a351df72f76f98ee1ed3494d025fe591fdb69.zip
Start the first client with a special socketpair so it is already known to the
server rather than playing silly games to get them synchronised before doing anything. Change attach-session to start the server.
Diffstat (limited to 'cmd-attach-session.c')
-rw-r--r--cmd-attach-session.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmd-attach-session.c b/cmd-attach-session.c
index b622aaab..2686563a 100644
--- a/cmd-attach-session.c
+++ b/cmd-attach-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-attach-session.c,v 1.21 2008-12-10 20:25:41 nicm Exp $ */
+/* $Id: cmd-attach-session.c,v 1.22 2009-01-19 17:16:09 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -29,7 +29,7 @@ void cmd_attach_session_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_attach_session_entry = {
"attach-session", "attach",
"[-d] " CMD_TARGET_SESSION_USAGE,
- CMD_DFLAG|CMD_CANTNEST,
+ CMD_DFLAG|CMD_CANTNEST|CMD_STARTSERVER,
cmd_target_init,
cmd_target_parse,
cmd_attach_session_exec,
@@ -45,10 +45,14 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
struct cmd_target_data *data = self->data;
struct session *s;
char *cause;
-
+
if (ctx->curclient != NULL)
return;
+ if (ARRAY_LENGTH(&sessions) == 0) {
+ ctx->error(ctx, "no sessions");
+ return;
+ }
if ((s = cmd_find_session(ctx, data->target)) == NULL)
return;