فهرست منبع

Check that socket is still alive before writing

Writing to a disconnected socket causes process to be terminated by SIGPIPE.
Here it also stop the routine "stop_server_without_decrypt" and causes to not stopping server.
NexusTiTi 5 سال پیش
والد
کامیت
44c127cb6d
1فایلهای تغییر یافته به همراه8 افزوده شده و 4 حذف شده
  1. 8 4
      KKrcon/HL2.pm

+ 8 - 4
KKrcon/HL2.pm

@@ -89,9 +89,13 @@ sub run {
 	}
 
 	my $socket = $self->socket();
-	print $socket $self->packet(CMD, $command);
-
-	return $self->response();
+	if($socket->connected)
+	{
+		print $socket $self->packet(CMD, $command);
+		return $self->response();
+	}
+	
+	return;
 }
 
 # create tcp socket
@@ -339,4 +343,4 @@ Chris Jones, E<lt>[email protected]<gt>
  it under the same terms as Perl itself, either Perl version 5.8.5 or,
  at your option, any later version of Perl 5 you may have available.
 
-=cut
+=cut