=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/channels.c,v retrieving revision 1.421 retrieving revision 1.422 diff -u -r1.421 -r1.422 --- src/usr.bin/ssh/channels.c 2022/11/18 19:47:40 1.421 +++ src/usr.bin/ssh/channels.c 2023/01/06 02:38:23 1.422 @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.c,v 1.421 2022/11/18 19:47:40 mbuhl Exp $ */ +/* $OpenBSD: channels.c,v 1.422 2023/01/06 02:38:23 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -2368,7 +2368,7 @@ enum channel_table { CHAN_PRE, CHAN_POST }; static void -channel_handler(struct ssh *ssh, int table, time_t *unpause_secs) +channel_handler(struct ssh *ssh, int table, struct timespec *timeout) { struct ssh_channels *sc = ssh->chanctxt; chan_fn **ftab = table == CHAN_PRE ? sc->channel_pre : sc->channel_post; @@ -2377,8 +2377,6 @@ time_t now; now = monotime(); - if (unpause_secs != NULL) - *unpause_secs = 0; for (i = 0, oalloc = sc->channels_alloc; i < oalloc; i++) { c = sc->channels[i]; if (c == NULL) @@ -2398,24 +2396,17 @@ */ if (c->notbefore <= now) (*ftab[c->type])(ssh, c); - else if (unpause_secs != NULL) { + else if (timeout != NULL) { /* - * Collect the time that the earliest - * channel comes off pause. + * Arrange for poll wakeup when channel pause + * timer expires. */ - debug3_f("chan %d: skip for %d more " - "seconds", c->self, - (int)(c->notbefore - now)); - if (*unpause_secs == 0 || - (c->notbefore - now) < *unpause_secs) - *unpause_secs = c->notbefore - now; + ptimeout_deadline_monotime(timeout, + c->notbefore); } } channel_garbage_collect(ssh, c); } - if (unpause_secs != NULL && *unpause_secs != 0) - debug3_f("first channel unpauses in %d seconds", - (int)*unpause_secs); } /* @@ -2561,7 +2552,7 @@ /* * Allocate/prepare poll structure */ void channel_prepare_poll(struct ssh *ssh, struct pollfd **pfdp, u_int *npfd_allocp, - u_int *npfd_activep, u_int npfd_reserved, time_t *minwait_secs) + u_int *npfd_activep, u_int npfd_reserved, struct timespec *timeout) { struct ssh_channels *sc = ssh->chanctxt; u_int i, oalloc, p, npfd = npfd_reserved; @@ -2585,7 +2576,7 @@ *npfd_activep = npfd_reserved; oalloc = sc->channels_alloc; - channel_handler(ssh, CHAN_PRE, minwait_secs); + channel_handler(ssh, CHAN_PRE, timeout); if (oalloc != sc->channels_alloc) { /* shouldn't happen */