Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
garnier-quentin committed Jul 4, 2024
1 parent 3739e06 commit 0cfc3f7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gorgone/gorgone/class/clientzmq.pm
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ sub ping {
if ($self->{ping} > 0 && $self->{ping_progress} == 0 &&
time() - $self->{ping_time} > $self->{ping}) {
$self->{ping_progress} = 1;
$self->{ping_time} = time();
$self->{ping_timeout_time} = time();
my $action = defined($options{action}) ? $options{action} : 'PING';
$self->send_message(action => $action, data => $options{data}, json_encode => $options{json_encode});
Expand Down Expand Up @@ -317,14 +318,15 @@ sub add_watcher {
sub event {
my ($self, %options) = @_;

$connectors->{ $options{identity} }->{ping_time} = time();

while ($sockets->{ $options{identity} }->has_pollin()) {
my ($rv, $message) = gorgone::standard::library::zmq_dealer_read_message(socket => $sockets->{ $options{identity} });
next if ($connectors->{ $options{identity} }->{handshake} == -1);
next if ($rv);

# We have a response. So it's ok :)
if ($connectors->{ $options{identity} }->{ping_progress} == 1) {
$connectors->{ $options{identity} }->{ping_time} = time();
$connectors->{ $options{identity} }->{ping_progress} = 0;
}

Expand Down

0 comments on commit 0cfc3f7

Please sign in to comment.