Diff for /loncom/loncnew between versions 1.77 and 1.78

version 1.77, 2007/03/27 19:38:36 version 1.78, 2007/03/28 00:05:38
Line 1529  another event handler to subess requests Line 1529  another event handler to subess requests
 =cut  =cut
   
 sub SetupLoncListener {  sub SetupLoncListener {
       my ($host,$SocketName) = @_;
       if (!$host) { $host = &GetServerHost(); }
       if (!$SocketName) { $SocketName = &GetLoncSocketPath($host); }
   
     my $host       = GetServerHost(); # Default host.  
     if (@_) {  
  ($host)    = @_ # Override host with parameter.  
     }  
   
     my $socket;  
     my $SocketName = GetLoncSocketPath($host);  
     unlink($SocketName);      unlink($SocketName);
   
       my $socket;
     unless ($socket =IO::Socket::UNIX->new(Local  => $SocketName,      unless ($socket =IO::Socket::UNIX->new(Local  => $SocketName,
     Listen => 250,       Listen => 250, 
     Type   => SOCK_STREAM)) {      Type   => SOCK_STREAM)) {
Line 1844  sub get_remote_hostname { Line 1843  sub get_remote_hostname {
  my $socket    = $watcher->fd;   my $socket    = $watcher->fd;
   
  my $thisread;   my $thisread;
  my $rv = $socket->recv($thisread, 1, 0);   my $rv = $socket->recv($thisread, POSIX::BUFSIZ, 0);
  Debug(8, "rcv:  data length = ".length($thisread)." read =".$thisread);   Debug(8, "rcv:  data length = ".length($thisread)." read =".$thisread);
  if (!defined($rv) || length($thisread) == 0) {   if (!defined($rv) || length($thisread) == 0) {
     # Likely eof on socket.      # Likely eof on socket.
Line 1890  sub parent_listen { Line 1889  sub parent_listen {
     my ($loncapa_host) = @_;      my ($loncapa_host) = @_;
     Debug(5, "parent_listen: $loncapa_host");      Debug(5, "parent_listen: $loncapa_host");
   
     my $socket   = &SetupLoncListener($loncapa_host);      my ($socket,$file);
       if (!$loncapa_host) {
    $loncapa_host = 'common_parent';
    $file         = $perlvar{'lonSockCreate'};
       } else {
    $file         = &GetLoncSocketPath($loncapa_host);
       }
       $socket = &SetupLoncListener($loncapa_host,$file);
   
     $listening_to{$socket} = $loncapa_host;      $listening_to{$socket} = $loncapa_host;
     if (!$socket) {      if (!$socket) {
  die "Unable to create a listen socket for $loncapa_host";   die "Unable to create a listen socket for $loncapa_host";
     }      }
           
     my $lock_file = &GetLoncSocketPath($loncapa_host).".lock";      my $lock_file = $file.".lock";
     unlink($lock_file); # No problem if it doesn't exist yet [startup e.g.]      unlink($lock_file); # No problem if it doesn't exist yet [startup e.g.]
   
     my $watcher =       my $watcher = 
Line 1950  sub listen_on_all_unix_sockets { Line 1957  sub listen_on_all_unix_sockets {
   
 sub listen_on_common_socket {  sub listen_on_common_socket {
     Debug(5, "listen_on_common_socket");      Debug(5, "listen_on_common_socket");
     &parent_listen('common');      &parent_listen();
 }  }
   
 #   server_died is called whenever a child process exits.  #   server_died is called whenever a child process exits.

Removed from v.1.77  
changed lines
  Added in v.1.78


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>