[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: LuaSocket is fine on OpenBSD. Bug was in test.
- From: Diego Nehab <diego@...>
- Date: Thu, 13 Apr 2006 17:11:55 -0400 (EDT)
Hi,
There was a bug in the test submitted by the user:
...
local readable,writable,e=socket.select(receive_sockets)
for src, _ in ipairs(readable) do
local udp=receive_sockets[src]
...
The index 'src' is valid only for table 'readable'. Not for table
'receive_sockets'. In fact, there is no need to use the index.
...
local readable,writable,e=socket.select(receive_sockets)
for _, udp in ipairs(readable) do
...
This is a simpler alternative.
The reason the code worked in some systems is that when all
sockets are readable simultaneously, the indices on both
tables end up matching so the bug goes unnoticed.
Regards,
Diego.