Jump to page: 1 2 3
Thread overview
[Issue 268] New: Bug with SocketSet and classes
Jul 29, 2006
d-bugmail
Feb 12, 2007
d-bugmail
Apr 29, 2007
d-bugmail
Jul 15, 2007
d-bugmail
Jul 15, 2007
d-bugmail
Jul 15, 2007
d-bugmail
Jul 15, 2007
d-bugmail
Jul 15, 2007
d-bugmail
Jul 15, 2007
d-bugmail
Jul 15, 2007
d-bugmail
Jul 15, 2007
d-bugmail
Jul 15, 2007
d-bugmail
Jul 16, 2007
d-bugmail
Jul 16, 2007
d-bugmail
Jul 16, 2007
d-bugmail
Jul 16, 2007
d-bugmail
Jul 16, 2007
d-bugmail
Jul 16, 2007
d-bugmail
Jul 16, 2007
d-bugmail
Jul 20, 2007
d-bugmail
Jul 20, 2007
d-bugmail
Jul 30, 2007
d-bugmail
July 29, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=268

           Summary: Bug with SocketSet and classes
           Product: D
           Version: 0.162
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: patch
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: felipe.contreras@gmail.com


If you do the following:

 new SocketSet (1);
 rset.reset ();
 rset.add (sock);

Inside a class, SocketSet:Add segfaults.

It only happens inside the class, and with values < than 256.

I added the following in socket.d and it seemed to work:

 if(nbytes < NFDBITS)
  nbytes = NFDBITS;


-- 

February 12, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=268


felipe.contreras@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical




-- 

April 29, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=268


thomas-dloop@kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Linux                       |All




------- Comment #1 from thomas-dloop@kuehne.cn  2007-04-29 02:10 -------
The real problem is that SocketSet.add uses the "in"
contract to enforce that not too many sockets are added
but phobos is compiled with the "-release" switch and thus
the tests skipped.

Socket.select has the same problem


-- 

July 15, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=268





------- Comment #2 from bugzilla@digitalmars.com  2007-07-15 14:10 -------
I don't know what this code does, so if someone who understands sockets can post a tested/correct patch, I'll fold it in.


-- 

July 15, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=268





------- Comment #3 from felipe.contreras@gmail.com  2007-07-15 16:26 -------
Created an attachment (id=150)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=150&action=view)
Proposed patch.


-- 

July 15, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=268





------- Comment #4 from felipe.contreras@gmail.com  2007-07-15 16:28 -------
Created an attachment (id=151)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=151&action=view)
Test.


-- 

July 15, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=268


felipe.contreras@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |felipe.contreras@gmail.com




------- Comment #5 from felipe.contreras@gmail.com  2007-07-15 16:34 -------
Only one year to comment, and I already provided the fix. I don't what to know what happens with problematic bugs.

Also the format of all the source files seems to be wrong.


-- 

July 15, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=268





------- Comment #6 from unknown@simplemachines.org  2007-07-15 16:40 -------
(In reply to comment #5)
> Also the format of all the source files seems to be wrong.
> 

As I recall, Walter uses the strange imho convention of 4 spaces to an indent, but 8 spaces to a tab.  Since many editors for any graphical interface use 4 spaces to a tab now, this can cause some confusion.

But don't worry, they are formatted properly when viewed through the right glasses.

-[Unknown]


-- 

July 15, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=268





------- Comment #7 from braddr@puremagic.com  2007-07-15 17:04 -------
The whole SocketSet class looks rather odd to me (given only a few minutes looking at it).  It's confusing 'max' as a number of sockets that can be added and the fact that the socket fd value won't necessarily have any relation to that count.  Other oddities are functions like this:

socket_t* first() { return cast(socket_t*)buf; }
fd_set* _fd_set() { return cast(fd_set*)buf; }

Treating the same block of memory as two different and incompatible things. Does this class even work as it's name suggests?

The proposed change to the constructor doesn't feel right given the arbitrary value that a socket fd might have.  Using anything other than FD_SETSIZE for 'max' is likely to result in problems.  NFDBITS is simply the number of bits that fit in a word which doesn't make much sense as a minimum for nbytes.

Really, I'd just ditch the entire concept of a variable size set.  It doesn't make any sense for unix style select() api's.  For other type of selection interfaces it might make more sense such as epoll on linux, but there the actual set is managed inside the kernel, not user space.


-- 

July 15, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=268





------- Comment #8 from bugzilla@digitalmars.com  2007-07-15 17:23 -------
Hence my request for help. The class seems to be a mess, and I don't know how to fix it because I don't know what it's supposed to be doing.


-- 

« First   ‹ Prev
1 2 3