projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branches 'mojo' and 'test' of ssh://server/scm/spider into test
[spider.git]
/
perl
/
Web.pm
diff --git
a/perl/Web.pm
b/perl/Web.pm
index fbba02f652d27ebebf118c55e9da89aa4d647f0b..eec12c688449f2d4c92809d795114612c36d1c9c 100644
(file)
--- a/
perl/Web.pm
+++ b/
perl/Web.pm
@@
-1,5
+1,5
@@
#
#
-# DXSpider - The Web Interface
+# DXSpider - The Web Interface
Helper Routines
#
# Copyright (c) 2015 Dirk Koopman G1TLH
#
#
# Copyright (c) 2015 Dirk Koopman G1TLH
#
@@
-8,18
+8,49
@@
use strict;
package Web;
package Web;
-use Mojolicious::Lite;
-use Mojo::IOLoop;
use DXDebug;
use DXDebug;
+use DXChannel;
+use DXLog;
-sub start_node
+require Exporter;
+our @ISA = qw(DXCommandmode Exporter);
+our @EXPORT = qw(is_webcall find_next_webcall);
+
+our $maxssid = 64; # the maximum number of bare @WEB connections we will allow - this is really to stop runaway connections from the dxweb app
+
+sub is_webcall
{
{
- dbg("Before Web::start_node");
+ return $_[0] =~ /^\#WEB/;
+}
- Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
+sub find_next_webcall
+{
+ foreach my $i (1 .. $maxssid) {
+ next if DXChannel::get("\#WEB-$i");
+ return "\#WEB-$i";
+ }
+ return undef;
+}
- dbg("After Web::start_node");
+sub new
+{
+ my $self = DXChannel::alloc(@_);
+
+ return $self;
}
}
+sub disconnect
+{
+ my $self = shift;
+ my $call = $self->call;
+
+ return if $self->{disconnecting}++;
+
+ delete $self->{senddbg};
+
+ LogDbg('DXCommand', "Web $call disconnected");
+ # this done to avoid any routing or remembering of unwanted stuff
+ DXChannel::disconnect($self);
+}
1;
1;