mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: don't ever block
Handle EAGAIN and EWOULDBLOCK and go back into the poll loop instead of blocking.
This commit is contained in:
		
							parent
							
								
									4bb859fb82
								
							
						
					
					
						commit
						165ad6e758
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -267,6 +267,8 @@ static int flush_messages(struct client *client)
 | 
			
		|||
			res = send(client->source->fd, data, size, MSG_NOSIGNAL | MSG_DONTWAIT);
 | 
			
		||||
			if (res < 0) {
 | 
			
		||||
				pw_log_info("send channel:%d %zu, res %d: %m", m->channel, size, res);
 | 
			
		||||
				if (errno == EAGAIN || errno == EWOULDBLOCK)
 | 
			
		||||
					break;
 | 
			
		||||
				if (errno == EINTR)
 | 
			
		||||
					continue;
 | 
			
		||||
				else
 | 
			
		||||
| 
						 | 
				
			
			@ -3974,7 +3976,10 @@ static int do_read(struct client *client)
 | 
			
		|||
		size = client->message->length - idx;
 | 
			
		||||
	}
 | 
			
		||||
	while (true) {
 | 
			
		||||
		if ((r = recv(client->source->fd, data, size, 0)) < 0) {
 | 
			
		||||
		if ((r = recv(client->source->fd, data, size, MSG_DONTWAIT)) < 0) {
 | 
			
		||||
			pw_log_info("recv client:%p res %d: %m", client, res);
 | 
			
		||||
			if (errno == EAGAIN || errno == EWOULDBLOCK)
 | 
			
		||||
				goto exit;
 | 
			
		||||
			if (errno == EINTR)
 | 
			
		||||
		                continue;
 | 
			
		||||
			res = -errno;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue