Skip to content

Commit

Permalink
enh(core): create random ipc file (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
garnier-quentin authored and Evan-Adam committed Jul 16, 2024
1 parent 8e0c4ea commit 0f72e93
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gorgone/gorgone/class/core.pm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use gorgone::standard::constants qw(:all);
use gorgone::standard::misc;
use gorgone::class::db;
use gorgone::class::listener;
use Time::HiRes;

my ($gorgone);

Expand Down Expand Up @@ -152,9 +153,11 @@ sub init {
$self->{config}->{configuration}->{gorgone}->{gorgonecore}->{external_com_zmq_tcp_keepalive} =
defined($self->{config}->{configuration}->{gorgone}->{gorgonecore}->{external_com_zmq_tcp_keepalive}) && $self->{config}->{configuration}->{gorgone}->{gorgonecore}->{external_com_zmq_tcp_keepalive} =~ /^(0|1)$/ ? $1 : 1;

my $time_hi = Time::HiRes::time();
$time_hi =~ s/\.//;
$self->{config}->{configuration}->{gorgone}->{gorgonecore}->{internal_com_type} = 'ipc'
if (!defined($self->{config}->{configuration}->{gorgone}->{gorgonecore}->{internal_com_type}) || $self->{config}->{configuration}->{gorgone}->{gorgonecore}->{internal_com_type} eq '');
$self->{config}->{configuration}->{gorgone}->{gorgonecore}->{internal_com_path} = '/tmp/gorgone/routing.ipc'
$self->{config}->{configuration}->{gorgone}->{gorgonecore}->{internal_com_path} = '/tmp/gorgone/routing-' . $time_hi . '.ipc'
if (!defined($self->{config}->{configuration}->{gorgone}->{gorgonecore}->{internal_com_path}) || $self->{config}->{configuration}->{gorgone}->{gorgonecore}->{internal_com_path} eq '');
$self->{config}->{configuration}->{gorgone}->{gorgonecore}->{timeout} =
defined($self->{config}->{configuration}->{gorgone}->{gorgonecore}->{timeout}) && $self->{config}->{configuration}->{gorgone}->{gorgonecore}->{timeout} =~ /(\d+)/ ? $1 : 50;
Expand Down Expand Up @@ -760,6 +763,9 @@ sub quit {
if (defined($self->{external_socket})) {
zmq_close($self->{external_socket});
}
if ($self->{config}->{configuration}->{gorgone}->{gorgonecore}->{internal_com_type} eq 'ipc') {
unlink($self->{config}->{configuration}->{gorgone}->{gorgonecore}->{internal_com_path});
}
exit(0);
}

Expand Down

0 comments on commit 0f72e93

Please sign in to comment.