From 3fa8f1636486420b9f27b129dbd0f36015d4c24b Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 27 Sep 2007 09:15:58 +0000 Subject: Adjust $TMUX environ var to include session index, and don't compact session list on release. Also fix some argument types. --- server-fn.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'server-fn.c') diff --git a/server-fn.c b/server-fn.c index 668712b0..0429af94 100644 --- a/server-fn.c +++ b/server-fn.c @@ -1,4 +1,4 @@ -/* $Id: server-fn.c,v 1.2 2007-09-26 18:09:23 nicm Exp $ */ +/* $Id: server-fn.c,v 1.3 2007-09-27 09:15:58 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -24,11 +24,13 @@ /* Write command to a client. */ void -server_write_client(struct client *c, u_int cmd, void *buf, size_t len) +server_write_client(struct client *c, enum hdrtype type, void *buf, size_t len) { struct hdr hdr; - hdr.type = cmd; + log_debug("writing %d to client %d", type, c->fd); + + hdr.type = type; hdr.size = len; buffer_write(c->out, &hdr, sizeof hdr); @@ -39,11 +41,13 @@ server_write_client(struct client *c, u_int cmd, void *buf, size_t len) /* Write command to a client with two buffers. */ void server_write_client2(struct client *c, - u_int cmd, void *buf1, size_t len1, void *buf2, size_t len2) + enum hdrtype type, void *buf1, size_t len1, void *buf2, size_t len2) { struct hdr hdr; - hdr.type = cmd; + log_debug("writing %d to client %d", type, c->fd); + + hdr.type = type; hdr.size = len1 + len2; buffer_write(c->out, &hdr, sizeof hdr); @@ -55,19 +59,22 @@ server_write_client2(struct client *c, /* Write command to all clients attached to a specific window. */ void -server_write_clients(struct window *w, u_int cmd, void *buf, size_t len) +server_write_clients( + struct window *w, enum hdrtype type, void *buf, size_t len) { struct client *c; struct hdr hdr; u_int i; - hdr.type = cmd; + hdr.type = type; hdr.size = len; for (i = 0; i < ARRAY_LENGTH(&clients); i++) { c = ARRAY_ITEM(&clients, i); if (c != NULL && c->session != NULL) { if (c->session->window == w) { + log_debug( + "writing %d to clients: %d", type, c->fd); buffer_write(c->out, &hdr, sizeof hdr); if (buf != NULL) buffer_write(c->out, buf, len); -- cgit