What should I do about it?
This problem just happpened , and it has error massage "
Can't call method "connected" on an undefined value at D:\setopk\BotOrganizer\Profiles\.....\Plugin/Sirens.pl line 51.
"
error.txt
Died at this line:
if ($switch eq '02A6') {
* unless ($sirens_socket->connected()) {
return unless (connect2sirens(\$sirens_socket));
can't connect to sirens server
Moderator: Moderators
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: can't connect to sirens server
Problem in that plugin.
Re: can't connect to sirens server
Could you help me ?
I will copy it at overhere.
I will copy it at overhere.
Re: can't connect to sirens server
Code: Select all
package Sirens;
use strict;
use Globals;
use Plugins;
use Log qw(error);
use Misc qw(relog);
use Utils qw(dataWaiting);
use IO::Socket::INET;
Plugins::register('Sirens', 'Sirens Server Plugin', \&onUnload);
my $hooks = Plugins::addHooks(
['initialized', \&onInitialized],
['mainLoop_pre', \&onMainLoopPre],
['parseMsg/pre', \&onParseMsg]
);
sub onUnload {
Plugins::delHooks($hooks);
};
my $sirens_host = 'xxxxxxx';
my $sirens_port = xxxxx;
my ($sirens_socket, $failecount);
sub onInitialized {
$sirens_socket = IO::Socket::INET->new();
connect2sirens(\$sirens_socket);
}
sub onMainLoopPre {
if (dataWaiting(\$sirens_socket)) {
my $buf;
$sirens_socket->recv($buf, 512);
$net->serverSend($buf) if (length($buf) > 1);
}
if ($failecount >= 3) {
quit();
}
}
sub onParseMsg {
my $args = $_[1];
my $switch = $args->{switch};
my $msg = $args->{msg};
my $msg_size = $args->{msg_size};
if ($switch eq '02A6') {
unless ($sirens_socket->connected()) {
return unless (connect2sirens(\$sirens_socket));
}
$sirens_socket->send(substr($msg, 0, $msg_size));
}
}
sub connect2sirens {
my ($r_socket) = @_;
${$r_socket} = IO::Socket::INET->new(
PeerAddr => $sirens_host,
PeerPort => $sirens_port,
Proto => 'tcp'
);
if (${$r_socket} && inet_aton(${$r_socket}->peerhost()) eq inet_aton($sirens_host)) {
$failecount = 0;
return 1;
} else {
error("Can't connect to Sirens Server.\n");
relog() if ($conState == 5);
$failecount++;
return 0;
}
}
return 1;