ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/syncmail/vc.pm
(Generate patch)

Comparing syncmail/vc.pm (file contents):
Revision 1.3 by root, Sun Oct 28 20:52:25 2001 UTC vs.
Revision 1.4 by root, Mon Oct 29 00:37:41 2001 UTC

43# create (connect) a new vc 43# create (connect) a new vc
44sub create { 44sub create {
45 my $class = shift; 45 my $class = shift;
46 my $self = $class->catch(port => ($port += 2), @_); 46 my $self = $class->catch(port => ($port += 2), @_);
47 47
48 $self->snd("pri", $self->{pri}) if $self->{pri};
49
50 $self; 48 $self;
51} 49}
52 50
53sub DESTROY { 51sub DESTROY {
54 &close; 52 &close;
56 54
57sub close { 55sub close {
58 my $self = shift; 56 my $self = shift;
59 57
60 if ($self->{port}) { 58 if ($self->{port}) {
59 slog 0, "closing port $self->{port}\n";#d#
61 push @{$send[0]}, pack "nn", $self->{port}, 65535; 60 push @{$send[0]}, pack "nn", $self->{port}, 65535;
61 $send_full->send;
62 delete $self->{port}; 62 delete $self->{port};
63 } 63 }
64} 64}
65 65
66sub pri { 66sub pri {
67 my $self = shift; 67 my $self = shift;
68 $self->{pri} = $_[0]; 68 $self->{pri} = $_[0];
69 $self->snd("pri", $_[0]);
70} 69}
71 70
72sub _snd { 71sub _snd {
73 my $self = shift; 72 my $self = shift;
74 73
188 $fh->sysread($data, $len) == $len 187 $fh->sysread($data, $len) == $len
189 or die "unexpected read error: $!"; 188 or die "unexpected read error: $!";
190 189
191 slog 8, "<<< :$port ".dumpstr($data)."\n"; #d# 190 slog 8, "<<< :$port ".dumpstr($data)."\n"; #d#
192 191
193 ($port[$port] ||= do { 192 unless ($port[$port]) {
194 my $vc = catch vc port => $port; 193 async \&::serve, catch vc port => $port;
195 async \&::serve, $vc;
196 $vc; 194 }
195
197 })->feed($data); 196 $port[$port]->feed($data);
198 } 197 }
199 } else { 198 } else {
200 slog 8, "<<< :$port <$len>\n"; 199 slog 8, "<<< :$port <$len>\n";
201 200
202 if ($len == 0) { 201 if ($len == 0) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines