listener.d: Range violation.
Jesse Brands
jesse.brands at gmail.com
Sun May 29 13:38:41 PDT 2011
Hello there,
For a small chat server thingie I'm making, I decided to use D; finding myself
with a very neat example from listener.d to get a kick start I decided to
pretty much take the example over! However, I'm stuck on a bug I can't truly
wrap my finger around. Most likely it's my own fault and I'm doing something
wrong, but considering I took the code pretty much from the example I am more
inclined to believe the example is broken.
I'll explain what happens:
-- I start up my server (nothing wrong, it's running as it should and listening)
-- I telnet to it. My server accepts the connection.
-- I use telnet to send some information. Server handles the information
properly, again, no issue.
-- I quit telnet by using ^] and then writing quit. Breaking the connection
rather ungracefully.
-- The server properly recognises this isn't a clean disconnect and executes
the code to remove the socket.
-- I then get a range violation.
This is the main process and it's loop:
https://github.com/JGBrands/BlaatServer/blob/master/source/bserver.d
This is the server class, the code where it deletes the socket is at the
complete bottom in the function void destroySocket(int index);
https://github.com/JGBrands/BlaatServer/blob/master/source/server.d
The code is primarily taken over from the listener.d example like I said, the
error I get is this:
core.exception.RangeError at server(61): Range violation
----------------
----------------
I'm lead to believe the function is deleting something it shouldn't, for those
interested, this is line 61 in server.d:
if (this.sset.isSet(this.reads[i])) {
More information about the Digitalmars-d-learn
mailing list