From: Martin Mares Date: Fri, 29 Jun 2007 15:03:42 +0000 (+0200) Subject: Changed buffer flushing to explicit in a vain attempt to hunt down problems X-Git-Tag: python-dummy-working~327^2~8 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=babd817998d5e7026a3e392024779216ab59ca94;p=moe.git Changed buffer flushing to explicit in a vain attempt to hunt down problems with broken connections. --- diff --git a/TODO b/TODO index b2c726b..e219005 100644 --- a/TODO +++ b/TODO @@ -20,6 +20,7 @@ New submitter: - contest: override failed check - contest: local history - contest: task status cache +- contest: problems with SIGPIPE Various ideas: scores dependent on time (like PL olympiad) diff --git a/submit/MO/Submit.pm b/submit/MO/Submit.pm index 4497eef..e571be3 100644 --- a/submit/MO/Submit.pm +++ b/submit/MO/Submit.pm @@ -68,6 +68,7 @@ sub disconnect($) { sub connect($) { my $self = shift @_; $self->disconnect; + $self->log("Connecting to submit server"); my $sk = new IO::Socket::INET( PeerAddr => $self->{"Server"}, @@ -106,6 +107,7 @@ sub connect($) { } } $self->{"sk"} = $sk; + $sk->autoflush(0); $self->log("Logging in"); my $req = new Sherlock::Object("U" => $self->{"user"}); @@ -123,12 +125,14 @@ sub connect($) { sub request($$) { my ($self, $obj) = @_; my $sk = $self->{"sk"}; - $obj->write($sk); ### FIXME: Flushing + ## $SIG{'PIPE'} = 'ignore'; + $obj->write($sk); + print $sk "\n"; + $sk->flush(); if ($sk->error) { $self->err("Connection broken"); return undef; } - print $sk "\n"; return $self->reply; }