Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002986 [Croquet] Hedgehog major always 02-20-06 23:14 04-21-06 07:30
Reporter howardstearns View Status public  
Assigned To andreas
Priority normal Resolution fixed  
Status resolved  
Summary 0002986: apple macintosh can be master or participant, but not both
Description I can run croquet or demo master on a Mac, and then run a participant to that master on a Windows box on the same LAN.

And vice versa.

But I when I run a master on the Mac, I can't run the corresponding participant from the same machine.
(I can run master and participant on the same Windows box.)
Additional Information
Attached Files  SocketExtensions.cs [^] (23,783 bytes) 03-13-06 23:19
 ContactPointReusePort.1.cs [^] (1,504 bytes) 03-13-06 23:19
 ContactPointReusePort.2.cs.zip [^] (1,070 bytes) 04-19-06 15:54

- Relationships
related to 0003306resolved mpm connection closed while waiting for data 

- Notes
(0004447 - 2453 - 3030 - 3186 - 3186 - 3186 - 3186)
howardstearns
03-13-06 23:20

Summary: fixed with the attached changesets, which require DPR's VM. The problem was lack of support for SO_REUSEPORT.
   --------------------------------
When there are multiple Harnesses, there are multiple instances of TContactPoint, and each of these opens a socket at the same address/port.

It ought to be possible to arrange for this by using Socket>>setOption:value: for SO_REUSEPORT (and possibly also requiring SO_REUSEADDR). Alas, in the 3.8.4 vm source tree, neither platforms/unix/plugins/SocketPlugin/sqUnixSocket.c nor platforms/win32/plugins/SocketPlugin/sqWin32NetNet.c have SO_REUSEPORT in their list of allowable socket options. In fact, sqUnixSocket.c explicitly disallows it:

# if 0 /*** deliberately unsupported options -- do NOT enable these! ***/
  { "SO_REUSEPORT", SOL_SOCKET, SO_REUSEPORT },
/*omit other disallowed options */
#endif

This isn't hurting us on Windows, which seems to allow address/port reuse regardless of what you want.

Dave Reed's SocketPlugin defines a bunch of new functions, including one that does an end run around the above restriction:

/*
  set the SO_REUSEADDR, SO_REUSEPORT options for the socket.
*/
void sqSocketSetReusable (SocketPtr s)
{
  int err;

  if (!socketValid(s)) return;
  /* on some platforms SO_REUSEADDR and SO_REUSEPORT are different. Set both */
#ifdef SO_REUSEADDR
  err = setsockopt(SOCKET(s), SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
  if(err < 0) {
    interpreterProxy->success(false);
    return;
  }
#endif
#ifdef SO_REUSEPORT
  err = setsockopt(SOCKET(s), SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one));
  if(err < 0) {
    interpreterProxy->success(false);
    return;
  }
#endif
}

http://atsosxdev.doit.wisc.edu/croquet/SqueakNetX.zip [^] has:
  the binary VM for PC (built by DPR)
  the binary VM and Mac (built by Josh), and
  the source that DPR gave us.
I'll upload a new version with Josh's Mac source soon, so that we'll have everything together on this ticket.

To use this, you need the attached SocketExtension.cs from DPR.

Finally, the attached ContactPointReusePort.cs actually uses the new #setReuseable in TContactPoint>>initialize.

This whole combination (SocketExtensions.cs + ContactPointReusePort.cs + DPRs VM) has been tested successfully on both Windows and Mac over beta 2. (Testing was actually done in conjunction with the changesets attached to 2987 and 3297. That shouldn't matter....)
 
(0004760 - 152 - 164 - 164 - 164 - 164 - 164)
howardstearns
04-19-06 15:57

Fixed on Mac with ContactPointReusePort.2.cs (Note the .2).
Requires Mac VM 3.8.12beta3U and Croquet-Kernel-ar.25.
(I'm not set up for testing Linux.)
 

- Issue History
Date Modified Username Field Change
02-20-06 23:14 howardstearns New Issue
03-13-06 23:19 howardstearns File Added: SocketExtensions.cs
03-13-06 23:19 howardstearns File Added: ContactPointReusePort.1.cs
03-13-06 23:20 howardstearns Note Added: 0004447
03-14-06 17:49 howardstearns Relationship added related to 0003306
04-19-06 15:54 howardstearns File Added: ContactPointReusePort.2.cs.zip
04-19-06 15:57 howardstearns Note Added: 0004760
04-21-06 07:30 andreas Status new => resolved
04-21-06 07:30 andreas Resolution open => fixed
04-21-06 07:30 andreas Assigned To  => andreas


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
51 total queries executed.
35 unique queries executed.
Powered by Mantis Bugtracker