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:
@@ -39,13 +39,20 @@ static status_t
|
|||||||
link_monitor_data(void *cookie, net_buffer *packet)
|
link_monitor_data(void *cookie, net_buffer *packet)
|
||||||
{
|
{
|
||||||
link_protocol *protocol = (link_protocol *)cookie;
|
link_protocol *protocol = (link_protocol *)cookie;
|
||||||
|
|
||||||
// we need to make a clone for that buffer and pass it to the socket
|
// we need to make a clone for that buffer and pass it to the socket
|
||||||
net_buffer *buffer = gNetBufferModule.clone(packet, false);
|
net_buffer *buffer = gNetBufferModule.clone(packet, false);
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
return B_NO_MEMORY;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user