Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/eio_rawlink.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module Lowlevel = Rawlink_lowlevel

type t = {
flow : Eio_unix.socket;
fd : Unix.file_descr;
packets : Cstruct.t list ref;
buffer : Cstruct.t;
}
Expand All @@ -29,7 +28,7 @@ let dhcp_client_filter = Lowlevel.dhcp_client_filter
let open_link ?filter ?(promisc=false) ifname ~sw =
let fd = Lowlevel.opensock ?filter:filter ~promisc ifname in
let flow = Eio_unix.FD.as_socket ~sw ~close_unix:true fd in
{ flow; fd; packets = ref []; buffer = (Cstruct.create 65536) }
{ flow; packets = ref []; buffer = (Cstruct.create 65536) }

let close_link t = t.flow#close

Expand All @@ -39,6 +38,6 @@ let rec read_packet t =
match !(t.packets) with
| hd :: tl -> t.packets := tl; hd
| [] ->
let n = Eio.Flow.read t.flow t.buffer in
let n = Eio.Flow.single_read t.flow t.buffer in
t.packets := Lowlevel.process_input t.buffer n;
read_packet t