mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
				synced 2025-11-03 21:43:32 +00:00 
			
		
		
		
	write_queue: Add a method to clear the queue.
This commit is contained in:
		@@ -38,6 +38,7 @@ struct write_queue {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void write_queue_init(struct write_queue *queue, int max_length);
 | 
					void write_queue_init(struct write_queue *queue, int max_length);
 | 
				
			||||||
 | 
					void write_queue_clear(struct write_queue *queue);
 | 
				
			||||||
int write_queue_enqueue(struct write_queue *queue, struct msgb *data);
 | 
					int write_queue_enqueue(struct write_queue *queue, struct msgb *data);
 | 
				
			||||||
int write_queue_bfd_cb(struct bsc_fd *fd, unsigned int what);
 | 
					int write_queue_bfd_cb(struct bsc_fd *fd, unsigned int what);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,3 +72,14 @@ int write_queue_enqueue(struct write_queue *queue, struct msgb *data)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void write_queue_clear(struct write_queue *queue)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						while (!llist_empty(&queue->msg_queue)) {
 | 
				
			||||||
 | 
							struct msgb *msg = msgb_dequeue(&queue->msg_queue);
 | 
				
			||||||
 | 
							msgb_free(msg);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						queue->current_length = 0;
 | 
				
			||||||
 | 
						queue->bfd.when &= ~BSC_FD_WRITE;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user