mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Don't reenlist the client imsg event every loop, instead have a small function
to it and call it after the event triggers or after a imsg is added.
This commit is contained in:
		
							
								
								
									
										16
									
								
								server-fn.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								server-fn.c
									
									
									
									
									
								
							@@ -59,6 +59,7 @@ server_write_client(
 | 
			
		||||
		return;
 | 
			
		||||
	log_debug("writing %d to client %d", type, c->ibuf.fd);
 | 
			
		||||
	imsg_compose(ibuf, type, PROTOCOL_VERSION, -1, -1, (void *) buf, len);
 | 
			
		||||
	server_update_event(c);	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
@@ -371,3 +372,18 @@ server_clear_identify(struct client *c)
 | 
			
		||||
		server_redraw_client(c);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
server_update_event(struct client *c)
 | 
			
		||||
{
 | 
			
		||||
	short	events;
 | 
			
		||||
 | 
			
		||||
	events = 0;
 | 
			
		||||
	if (!(c->flags & CLIENT_BAD))
 | 
			
		||||
		events |= EV_READ;
 | 
			
		||||
	if (c->ibuf.w.queued > 0)
 | 
			
		||||
		events |= EV_WRITE;
 | 
			
		||||
	event_del(&c->event);
 | 
			
		||||
	event_set(&c->event, c->ibuf.fd, events, server_client_callback, c);
 | 
			
		||||
	event_add(&c->event, NULL);	
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user