Skip to content

Commit

Permalink
Fixed restart function in rc.d script and fixed bulk images LWP requests
Browse files Browse the repository at this point in the history
  • Loading branch information
zhmylove committed Feb 12, 2016
1 parent 6b5521d commit 5f1bd9d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rc.d/jplbot
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
# made by: KorG

# PROVIDE: jplbot
# REQUIRE: LOGIN
Expand Down Expand Up @@ -35,6 +36,7 @@ case $1 in
echo "`date +%x.%H%M%S` restarting $name" >>"$logfile"

kill `cat "$ppidfile"` 2>/dev/null
while [ -r "$ppidfile" ]; do printf . ;sleep 1 ;done

start
;;
Expand Down
6 changes: 5 additions & 1 deletion src/jplbot.pl
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ sub new_bot_message {
}

if ($type{'image'}) {
return if $response->code >= 300;

my $length = $response->header('Content-Length') // -1;
$length = -1 unless $length > 0;

Expand All @@ -354,7 +356,9 @@ sub new_bot_message {

return if $dead;

if ($type{'html'}) {
if ($type{'image'}) {
# do nothing for all other chunks of response
} elsif ($type{'html'}) {
my $content = $response->decoded_content // '';

return if scalar $response->code < 200 ||
Expand Down

0 comments on commit 5f1bd9d

Please sign in to comment.