summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/channels.c b/channels.c
index a1aa937ae..f4f2c4942 100644
--- a/channels.c
+++ b/channels.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: channels.c,v 1.106 2001/04/11 13:56:13 markus Exp $"); 43RCSID("$OpenBSD: channels.c,v 1.107 2001/04/13 22:46:52 beck Exp $");
44 44
45#include <openssl/rsa.h> 45#include <openssl/rsa.h>
46#include <openssl/dsa.h> 46#include <openssl/dsa.h>
@@ -1843,6 +1843,41 @@ channel_still_open()
1843 return 0; 1843 return 0;
1844} 1844}
1845 1845
1846/* Returns the id of an open channel suitable for keepaliving */
1847
1848int
1849channel_find_open()
1850{
1851 u_int i;
1852 for (i = 0; i < channels_alloc; i++)
1853 switch (channels[i].type) {
1854 case SSH_CHANNEL_CLOSED:
1855 continue;
1856 case SSH_CHANNEL_LARVAL:
1857 case SSH_CHANNEL_DYNAMIC:
1858 case SSH_CHANNEL_AUTH_SOCKET:
1859 case SSH_CHANNEL_CONNECTING: /* XXX ??? */
1860 case SSH_CHANNEL_FREE:
1861 case SSH_CHANNEL_X11_LISTENER:
1862 case SSH_CHANNEL_PORT_LISTENER:
1863 case SSH_CHANNEL_RPORT_LISTENER:
1864 case SSH_CHANNEL_OPENING:
1865 case SSH_CHANNEL_OPEN:
1866 case SSH_CHANNEL_X11_OPEN:
1867 return i;
1868 case SSH_CHANNEL_INPUT_DRAINING:
1869 case SSH_CHANNEL_OUTPUT_DRAINING:
1870 if (!compat13)
1871 fatal("cannot happen: OUT_DRAIN");
1872 return i;
1873 default:
1874 fatal("channel_find_open: bad channel type %d", channels[i].type);
1875 /* NOTREACHED */
1876 }
1877 return -1;
1878}
1879
1880
1846/* 1881/*
1847 * Returns a message describing the currently open forwarded connections, 1882 * Returns a message describing the currently open forwarded connections,
1848 * suitable for sending to the client. The message contains crlf pairs for 1883 * suitable for sending to the client. The message contains crlf pairs for