added select() support to packet capturing

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20570 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Hugo Santos 2007-04-05 04:24:21 +00:00
parent fcd6d8cd92
commit df247f1480
1 changed files with 9 additions and 2 deletions

View File

@ -39,13 +39,20 @@ static status_t
link_monitor_data(void *cookie, net_buffer *packet)
{
link_protocol *protocol = (link_protocol *)cookie;
// we need to make a clone for that buffer and pass it to the socket
net_buffer *buffer = gNetBufferModule.clone(packet, false);
if (buffer == NULL)
return B_NO_MEMORY;
return fifo_enqueue_buffer(&protocol->fifo, buffer);
status_t status = fifo_enqueue_buffer(&protocol->fifo, buffer);
if (status >= B_OK)
notify_socket(protocol->socket, B_SELECT_READ,
protocol->fifo.current_bytes);
else
gNetBufferModule.free(buffer);
return status;
}