 +			else if (events[i].data.fd == peer_pty)
 +			{
 +				int len;
++
++				len = read(peer_pty, peer_buf, sizeof(peer_buf));
++				if (the_pty.fd >= 0 && len > 0)
++				{
++					if (is_edge_mode)
++					{
++						epoll_ctl(efd, EPOLL_CTL_MOD, peer_pty, &data_peer);
++						is_edge_mode = 0;
++					}
++					eintr_write(the_pty.fd, peer_buf, len);
++				}
++			}
++			else
++			{
++				/* The clients */
++				for (p = clients; p; p = next)
++				{
++					next = p->next;
++					if (events[i].data.fd == p->fd)
++					{
++						client_activity(p);
++						break;
++					}
++				}
++			}
++		}
  
 -		/* New client? */
 -		if (FD_ISSET(s, &readfds))

 
 	/* Set up some signals. */
 	signal(SIGPIPE, SIG_IGN);
@@ -508,6 +646,34 @@ master_process(int s, char **argv, int w
 		alarm(alarm_time);
 	}
 

 
 	int has_attached_client = 0;
 
@@ -475,6 +616,11 @@ master_process(int s, char **argv, int w
 
 	/* Create a pty in which the process is running. */
 	signal(SIGCHLD, die);
