Skip to content

Commit

Permalink
Add a version of read with a default size
Browse files Browse the repository at this point in the history
  • Loading branch information
msantos committed Sep 14, 2011
1 parent f82d443 commit 81acb18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -141,6 +141,7 @@ Tuncer is a stand up guy and just like him, tuncer has your back.

Set the gid owning the interface.

read(Ref) -> {ok, Buf} | {error, posix()}
read(Ref, Size) -> {ok, Buf} | {error, posix()}

Types Ref = pid()
Expand Down
5 changes: 4 additions & 1 deletion src/tuncer.erl
Expand Up @@ -40,7 +40,8 @@
persist/2,
owner/2, group/2,

read/2, write/2,
read/1, read/2,
write/2,

header/1,

Expand Down Expand Up @@ -119,6 +120,8 @@ mtu(Ref) when is_pid(Ref) ->
mtu(Ref, MTU) when is_pid(Ref), is_integer(MTU) ->
gen_server:call(Ref, {mtu, MTU}).

read(Ref) ->
read(Ref, 16#FFFF).
read(Ref, Len) when is_pid(Ref), is_integer(Len) ->
Fd = fd(Ref),
procket:read(Fd, Len).
Expand Down

0 comments on commit 81acb18

Please sign in to comment.