summaryrefslogtreecommitdiff
path: root/Echolot/Storage
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2002-06-11 11:06:07 +0000
committerPeter Palfrader <peter@palfrader.org>2002-06-11 11:06:07 +0000
commit27dc18ccb9551109287e81f10ab868edc3f36ec1 (patch)
tree2561a670c21a2980337f58e7afa319eea19965d3 /Echolot/Storage
parent41748299fdbd22a10e6da7208af312f55212b7db (diff)
Flush buffers after writing
Diffstat (limited to 'Echolot/Storage')
-rw-r--r--Echolot/Storage/File.pm15
1 files changed, 10 insertions, 5 deletions
diff --git a/Echolot/Storage/File.pm b/Echolot/Storage/File.pm
index b432a49..af6ba58 100644
--- a/Echolot/Storage/File.pm
+++ b/Echolot/Storage/File.pm
@@ -1,7 +1,7 @@
package Echolot::Storage::File;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: File.pm,v 1.4 2002/06/11 10:01:55 weasel Exp $
+# $Id: File.pm,v 1.5 2002/06/11 11:06:07 weasel Exp $
#
=pod
@@ -203,7 +203,7 @@ sub metadata_write($) {
print($fh $data) or
cluck("Error when writing to metadata file: $!"),
return 0;
-
+ $fh->flush();
return 1;
};
@@ -352,11 +352,13 @@ sub register_pingout($$$$) {
return 0;
seek($fh, 0, SEEK_END) or
- cluck("Cannot seek to end of $remailer_addr out pings: $!"),
+ cluck("Cannot seek to end of $remailer_addr; type=$type; key=$key; out pings: $!"),
return 0;
print($fh $sent_time."\n") or
- cluck("Error when writing to $remailer_addr out pings: $!"),
+ cluck("Error when writing to $remailer_addr; type=$type; key=$key; out pings: $!"),
return 0;
+ $fh->flush();
+print "registering pingout at $sent_time for $remailer_addr\n";
return 1;
};
@@ -370,7 +372,7 @@ sub register_pingdone($$$$$) {
my $outpings = $self->get_pings($remailer_addr, $type, $key, 'out');
my $origlen = scalar (@$outpings);
- @$outpings = grep { $_ != $sent_time } @$outpings;
+ @$outpings = grep { print "_: '$_'; st: '$sent_time'\n" ; $_ != $sent_time } @$outpings;
($origlen == scalar (@$outpings)) and
warn("No ping outstanding for $remailer_addr, $key, $sent_time\n"),
return 1;
@@ -385,6 +387,7 @@ sub register_pingdone($$$$$) {
print($fh $sent_time." ".$latency."\n") or
cluck("Error when writing to $remailer_addr out pings: $!"),
return 0;
+ $fh->flush();
# rewrite outstanding pings
$fh = $self->get_ping_fh($remailer_addr, $type, $key, 'out') or
@@ -399,6 +402,8 @@ sub register_pingdone($$$$$) {
print($fh (join "\n", @$outpings),"\n") or
cluck("Error when writing to outgoing pings file for remailer $remailer_addr; key=$key file: $!"),
return 0;
+ $fh->flush();
+print "registering pingdone from $sent_time with latency $latency for $remailer_addr\n";
return 1;
};