/[meteor]/googlecode.com/svn/trunk/Meteor/Connection.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /googlecode.com/svn/trunk/Meteor/Connection.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 37 by knops.gerd, Fri Feb 1 21:22:03 2008 UTC revision 50 by andrew.betts, Wed Feb 27 13:55:35 2008 UTC
# Line 111  sub newFromServer { Line 111  sub newFromServer {
111          $self->{'writeBuffer'}='';          $self->{'writeBuffer'}='';
112          $self->{'readBuffer'}='';          $self->{'readBuffer'}='';
113                    
114            $self->{'bytesWritten'}=0;
115            
116          push(@Connections,$self);          push(@Connections,$self);
117                    
118          &::syslog('debug',"New %s for %s",ref($self),$socket->{'connection'}->{'remoteIP'});          &::syslog('debug',"New %s for %s",ref($self),$socket->{'connection'}->{'remoteIP'});
# Line 195  sub checkHandleBits { Line 197  sub checkHandleBits {
197                  {                  {
198                          # Connection closed                          # Connection closed
199                          $self->{'remoteClosed'}=1;                          $self->{'remoteClosed'}=1;
200                          $self->close();                          $self->close(1, 'remoteClosed');
201                                                    
202                          return;                          return;
203                  }                  }
# Line 205  sub checkHandleBits { Line 207  sub checkHandleBits {
207                          {                          {
208                                  &::syslog('notice',"Connection closed: $!");                                  &::syslog('notice',"Connection closed: $!");
209                                  $self->{'remoteClosed'}=1;                                  $self->{'remoteClosed'}=1;
210                                  $self->close();                                  $self->close(1, 'remoteClosed');
211                                                                    
212                                  return;                                  return;
213                          }                          }
# Line 224  sub checkHandleBits { Line 226  sub checkHandleBits {
226                  if(defined($bytesWritten) && $bytesWritten>0)                  if(defined($bytesWritten) && $bytesWritten>0)
227                  {                  {
228                          $::Statistics->{'total_outbound_bytes'}+=$bytesWritten;                          $::Statistics->{'total_outbound_bytes'}+=$bytesWritten;
229                            $self->{'bytesWritten'}+=$bytesWritten;
230                          $self->{'writeBuffer'}=substr($self->{'writeBuffer'},$bytesWritten);                          $self->{'writeBuffer'}=substr($self->{'writeBuffer'},$bytesWritten);
231                          if(length($self->{'writeBuffer'})==0)                          if(length($self->{'writeBuffer'})==0)
232                          {                          {
# Line 241  sub checkHandleBits { Line 244  sub checkHandleBits {
244                          {                          {
245                                  &::syslog('notice',"Connection closed: $!");                                  &::syslog('notice',"Connection closed: $!");
246                                  $self->{'remoteClosed'}=1;                                  $self->{'remoteClosed'}=1;
247                                  $self->close();                                  $self->close(1, 'remoteClosed');
248                                                                    
249                                  return;                                  return;
250                          }                          }
# Line 282  sub close { Line 285  sub close {
285          # Remove connection from list of connections          # Remove connection from list of connections
286          #          #
287          my $idx=undef;          my $idx=undef;
288          for(my $i=0;$i<scalar(@Connections);$i++)          my $numcon = scalar(@Connections);
289            for(my $i=0;$i<$numcon;$i++)
290          {          {
291                  if($Connections[$i]==$self)                  if($Connections[$i]==$self)
292                  {                  {

Legend:
Removed from v.37  
changed lines
  Added in v.50

  ViewVC Help
Powered by ViewVC 1.1.26