/[pgp-tools]/trunk/caff/caff
ViewVC logotype

Diff of /trunk/caff/caff

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

revision 23 by weasel, Wed Oct 20 11:16:28 2004 UTC revision 24 by weasel, Wed Oct 20 11:37:16 2004 UTC
# Line 200  sub info($) { Line 200  sub info($) {
200  };  };
201  sub debug($) {  sub debug($) {
202          my ($line) = @_;          my ($line) = @_;
203          #print "[DEBUG] $line\n";          print "[DEBUG] $line\n";
204  };  };
205  sub trace($) {  sub trace($) {
206          my ($line) = @_;          my ($line) = @_;
# Line 249  sub readwrite_gpg($$$$$%) { Line 249  sub readwrite_gpg($$$$$%) {
249          my $exitwhenstatusmatches = $options{'exitwhenstatusmatches'};          my $exitwhenstatusmatches = $options{'exitwhenstatusmatches'};
250          trace("doign stuff until we find $exitwhenstatusmatches") if defined $exitwhenstatusmatches;          trace("doign stuff until we find $exitwhenstatusmatches") if defined $exitwhenstatusmatches;
251    
252            my $readwrote_stuff_this_time = 0;
253            my $do_not_wait_on_select = 0;
254          my ($readyr, $readyw, $written);          my ($readyr, $readyw, $written);
255          while ($sout->count() > 0 || (defined($sin) && ($sin->count() > 0))) {          while ($sout->count() > 0 || (defined($sin) && ($sin->count() > 0))) {
256                  if (defined $exitwhenstatusmatches) {                  if (defined $exitwhenstatusmatches) {
257                          if ($status =~ /$exitwhenstatusmatches/m) {                          if ($status =~ /$exitwhenstatusmatches/m) {
258                                  trace("readwrite_gpg found match on $exitwhenstatusmatches");                                  trace("readwrite_gpg found match on $exitwhenstatusmatches");
259                                  last;                                  if ($readwrote_stuff_this_time) {
260                                            trace("read/write some more\n");
261                                            $do_not_wait_on_select = 1;
262                                    } else {
263                                            trace("that's it in our while loop.\n");
264                                            last;
265                                    }
266                          };                          };
267                  };                  };
268    
269                    $readwrote_stuff_this_time = 0;
270                  trace("select waiting for ".($sout->count())." fds.");                  trace("select waiting for ".($sout->count())." fds.");
271                  ($readyr, $readyw, undef) = IO::Select::select($sout, $sin, undef, 1);                  ($readyr, $readyw, undef) = IO::Select::select($sout, $sin, undef, $do_not_wait_on_select ? 0 : 1);
272                  trace("ready: write: ".(defined $readyw ? scalar @$readyw : 0 )."; read: ".(defined $readyr ? scalar @$readyr : 0));                  trace("ready: write: ".(defined $readyw ? scalar @$readyw : 0 )."; read: ".(defined $readyr ? scalar @$readyr : 0));
273                  for my $wfd (@$readyw) {                  for my $wfd (@$readyw) {
274                            $readwrote_stuff_this_time = 1;
275                          if (length($in) != $offset) {                          if (length($in) != $offset) {
276                                  trace("writing to $wfd.");                                  trace("writing to $wfd.");
277                                  $written = $wfd->syswrite($in, length($in) - $offset, $offset);                                  $written = $wfd->syswrite($in, length($in) - $offset, $offset);
# Line 281  sub readwrite_gpg($$$$$%) { Line 291  sub readwrite_gpg($$$$$%) {
291                  next unless (defined(@$readyr)); # Wait some more.                  next unless (defined(@$readyr)); # Wait some more.
292    
293                  for my $rfd (@$readyr) {                  for my $rfd (@$readyr) {
294                            $readwrote_stuff_this_time = 1;
295                          if ($rfd->eof) {                          if ($rfd->eof) {
296                                  trace("reading from $rfd done.");                                  trace("reading from $rfd done.");
297                                  $sout->remove($rfd);                                  $sout->remove($rfd);

Legend:
Removed from v.23  
changed lines
  Added in v.24

  ViewVC Help
Powered by ViewVC 1.1.5