comparison svr-chansession.c @ 1835:90ac15aeac43

Bring back recently removed channel->flushing This resolves the "sleep 10&echo hello" case which should return immediately
author Matt Johnston <matt@codeconstruct.com.au>
date Thu, 14 Oct 2021 20:55:15 +0800
parents c32976db772f
children 5c13e765ddbd
comparison
equal deleted inserted replaced
1834:94dc11094e26 1835:90ac15aeac43
52 static void sesssigchild_handler(int val); 52 static void sesssigchild_handler(int val);
53 static void closechansess(const struct Channel *channel); 53 static void closechansess(const struct Channel *channel);
54 static void cleanupchansess(const struct Channel *channel); 54 static void cleanupchansess(const struct Channel *channel);
55 static int newchansess(struct Channel *channel); 55 static int newchansess(struct Channel *channel);
56 static void chansessionrequest(struct Channel *channel); 56 static void chansessionrequest(struct Channel *channel);
57 static int sesscheckclose(const struct Channel *channel); 57 static int sesscheckclose(struct Channel *channel);
58 58
59 static void send_exitsignalstatus(const struct Channel *channel); 59 static void send_exitsignalstatus(const struct Channel *channel);
60 static void send_msg_chansess_exitstatus(const struct Channel * channel, 60 static void send_msg_chansess_exitstatus(const struct Channel * channel,
61 const struct ChanSess * chansess); 61 const struct ChanSess * chansess);
62 static void send_msg_chansess_exitsignal(const struct Channel * channel, 62 static void send_msg_chansess_exitsignal(const struct Channel * channel,
75 /* required to clear environment */ 75 /* required to clear environment */
76 extern char** environ; 76 extern char** environ;
77 77
78 /* Returns whether the channel is ready to close. The child process 78 /* Returns whether the channel is ready to close. The child process
79 must not be running (has never started, or has exited) */ 79 must not be running (has never started, or has exited) */
80 static int sesscheckclose(const struct Channel *channel) { 80 static int sesscheckclose(struct Channel *channel) {
81 struct ChanSess *chansess = (struct ChanSess*)channel->typedata; 81 struct ChanSess *chansess = (struct ChanSess*)channel->typedata;
82 TRACE(("sesscheckclose, pid %d, exitpid %d", chansess->pid, chansess->exit.exitpid)) 82 TRACE(("sesscheckclose, pid %d, exitpid %d", chansess->pid, chansess->exit.exitpid))
83
84 if (chansess->exit.exitpid != -1) {
85 channel->flushing = 1;
86 }
83 return chansess->pid == 0 || chansess->exit.exitpid != -1; 87 return chansess->pid == 0 || chansess->exit.exitpid != -1;
84 } 88 }
85 89
86 /* Handler for childs exiting, store the state for return to the client */ 90 /* Handler for childs exiting, store the state for return to the client */
87 91