diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-05-31 20:04:15 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-05-31 20:04:15 +0000 |
commit | 5569ff9723fcacb0e0206f02adbb4b85368bc1bf (patch) | |
tree | 76f9b0f74c209069e484a89554b66234ba40452f /client.c | |
parent | abe745f99126838079e8d70318983a3b66356573 (diff) |
Don't hang when window closes early; also add lots more debugging.
Diffstat (limited to 'client.c')
-rw-r--r-- | client.c | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -1,4 +1,4 @@ -/* $Id: client.c,v 1.25 2007-12-06 09:46:21 nicm Exp $ */ +/* $Id: client.c,v 1.26 2008-05-31 20:04:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -130,6 +130,19 @@ client_main(struct client_ctx *cctx) if (sigwinch) client_handle_winch(cctx); + switch (client_msg_dispatch(cctx, &error)) { + case -1: + goto out; + case 0: + /* May be more in buffer, don't let poll block. */ + timeout = 0; + break; + default: + /* Out of data, poll may block. */ + timeout = INFTIM; + break; + } + pfd.fd = cctx->srv_fd; pfd.events = POLLIN; if (BUFFER_USED(cctx->srv_out) > 0) @@ -143,19 +156,6 @@ client_main(struct client_ctx *cctx) if (buffer_poll(&pfd, cctx->srv_in, cctx->srv_out) != 0) goto server_dead; - - switch (client_msg_dispatch(cctx, &error)) { - case -1: - goto out; - case 0: - /* May be more in buffer, don't let poll block. */ - timeout = 0; - break; - default: - /* Out of data, poll may block. */ - timeout = INFTIM; - break; - } } out: |