Skip to content

Commit

Permalink
Merge pull request #181 from lukego/fixes
Browse files Browse the repository at this point in the history
Miscellaneous bug fixes
  • Loading branch information
lukego committed Jun 2, 2014
2 parents 05aadae + 3c8e512 commit 4dc6a6e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
11 changes: 6 additions & 5 deletions src/apps/ipv6/ns_responder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,17 @@ end
function ns_responder:push()
local l_in = self.input.north
local l_out = self.output.south
assert(l_in and l_out)
while not link.empty(l_in) and not link.full(l_out) do
-- Pass everything on north -> south
link.transmit(l_out, link.receive(l_in))
if l_in and l_out then
while not link.empty(l_in) and not link.full(l_out) do
-- Pass everything on north -> south
link.transmit(l_out, link.receive(l_in))
end
end
l_in = self.input.south
l_out = self.output.north
local l_reply = self.output.south
while not link.empty(l_in) and not link.full(l_out) do
local p = link.receive(l_in)
local p = packet.want_modify(link.receive(l_in))
local datagram = datagram:new(p, ethernet)
local status = process(self, datagram)
if status == nil then
Expand Down
2 changes: 1 addition & 1 deletion src/apps/socket/dev.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function dev:receive ()
local size = C.msg_size(self.fd)
assert(size ~= -1)
local p = packet.allocate()
local nbuffers = math.ceil(size/buffer.size)
local nbuffers = math.ceil(size/buffer.buffersize)
assert(nbuffers <= C.PACKET_IOVEC_MAX)
for i = 1, nbuffers do
local b = buffer.allocate()
Expand Down
2 changes: 1 addition & 1 deletion src/core/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ end

function exit (status)
if profiling then require("jit.p").stop() end
os.exit(0)
os.exit(status)
end

--- Globally initialize some things. Module can depend on this being done.
Expand Down
2 changes: 1 addition & 1 deletion src/core/packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct buffer_origin {

// A buffer describes a piece of memory with known size and physical address.
struct buffer {
char *pointer; // virtual address in this process
unsigned char *pointer; // virtual address in this process
uint64_t physical; // stable physical address
uint32_t size; // how many bytes in the buffer?
struct buffer_origin origin;
Expand Down
3 changes: 2 additions & 1 deletion src/core/packet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ function want_modify (p)
if p.refcount == 1 then
return p
end
local new_p = clone(p)
packet.deref(p)
return clone(p)
return new_p
end

-- fill's an allocated packet with data from a string
Expand Down

0 comments on commit 4dc6a6e

Please sign in to comment.