Skip to content

Commit

Permalink
Use a session termination message
Browse files Browse the repository at this point in the history
  • Loading branch information
nviennot committed Jan 2, 2016
1 parent 924eb01 commit 0a3bd83
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions session.c
Expand Up @@ -215,6 +215,10 @@ session_destroy(struct session *s)

log_debug("session %s destroyed", s->name);

#ifdef TMATE
tmate_write_fin();
#endif

RB_REMOVE(sessions, &sessions, s);
notify_session_closed(s);

Expand Down
6 changes: 6 additions & 0 deletions tmate-encoder.c
Expand Up @@ -224,3 +224,9 @@ void tmate_write_copy_mode(struct window_pane *wp, const char *str)
pack(int, wp->id);
pack(string, str);
}

void tmate_write_fin(void)
{
pack(array, 1);
pack(int, TMATE_OUT_FIN);
}
2 changes: 2 additions & 0 deletions tmate-protocol.h
Expand Up @@ -48,6 +48,7 @@ enum tmate_daemon_out_msg_types {
TMATE_OUT_STATUS,
TMATE_OUT_SYNC_COPY_MODE,
TMATE_OUT_WRITE_COPY_MODE,
TMATE_OUT_FIN,
};

/*
Expand All @@ -64,6 +65,7 @@ enum tmate_daemon_out_msg_types {
[int: type, string: input_prompt, string: input_str]])
// Any of the array can be []
[TMATE_OUT_WRITE_COPY_MODE, int: pane_id, string: str]
[TMATE_OUT_FIN]
*/

enum tmate_daemon_in_msg_types {
Expand Down
1 change: 1 addition & 0 deletions tmate.h
Expand Up @@ -84,6 +84,7 @@ extern void tmate_failed_cmd(int client_id, const char *cause);
extern void tmate_status(const char *left, const char *right);
extern void tmate_sync_copy_mode(struct window_pane *wp);
extern void tmate_write_copy_mode(struct window_pane *wp, const char *str);
extern void tmate_write_fin(void);

/* tmate-decoder.c */

Expand Down

0 comments on commit 0a3bd83

Please sign in to comment.