ClickSpotter 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +167 -0
- data/bin/clickspotter +4 -0
- data/data/worldmap-large.jpg +0 -0
- data/data/worldmap.png +0 -0
- data/lib/About.rb +22 -0
- data/lib/AboutDlg.rb +169 -0
- data/lib/AppConfig.rb +68 -0
- data/lib/AsyncResolverWithCache.rb +207 -0
- data/lib/BrowserLauncher.rb +23 -0
- data/lib/CSListView.rb +118 -0
- data/lib/CSListViewItem.rb +49 -0
- data/lib/ClickableCanvasView.rb +24 -0
- data/lib/Configuration.rb +123 -0
- data/lib/ConfigurationDlg.rb +372 -0
- data/lib/DNSResolver.rb +53 -0
- data/lib/GSServerLogSettings.rb +24 -0
- data/lib/GeoDistView.rb +351 -0
- data/lib/GeoLocator.rb +91 -0
- data/lib/GlobalSettings.rb +237 -0
- data/lib/HitRecord.rb +39 -0
- data/lib/HostNameDlg.rb +83 -0
- data/lib/LogFileSelector.rb +65 -0
- data/lib/LogFileSelectorDlg.rb +97 -0
- data/lib/LogParser.rb +120 -0
- data/lib/MainWindow.rb +627 -0
- data/lib/MainWindowDlg.rb +1054 -0
- data/lib/OccurenceCounter.rb +65 -0
- data/lib/PageInformation.rb +147 -0
- data/lib/PageInformationDlg.rb +159 -0
- data/lib/PageRecord.rb +77 -0
- data/lib/RefererInformation.rb +114 -0
- data/lib/RefererInformationDlg.rb +106 -0
- data/lib/RefererRecord.rb +51 -0
- data/lib/ServerLogSettings.rb +152 -0
- data/lib/ServerLogSettingsDlg.rb +202 -0
- data/lib/StatusCode.rb +72 -0
- data/lib/TraceRouter.rb +53 -0
- data/lib/VisitorInformation.rb +132 -0
- data/lib/VisitorInformationDlg.rb +351 -0
- data/lib/VisitorRecord.rb +94 -0
- data/lib/WorldMap.rb +93 -0
- data/lib/WorldMapDlg.rb +166 -0
- data/lib/clickspotter.rb +38 -0
- metadata +87 -0
data/README
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
= About ClickSpotter
|
2
|
+
|
3
|
+
ClickSpotter is a real-time web server logfile monitor with IP
|
4
|
+
geolocation support. It has three main features that differentiate it from
|
5
|
+
the rest of the log file analyzers.
|
6
|
+
|
7
|
+
* It processes your Apache access log file in real-time and produces
|
8
|
+
consolidated live reports about your visitors and current page
|
9
|
+
accesses.
|
10
|
+
|
11
|
+
* It can pinpoint your visitors and the path they used through the
|
12
|
+
Internet on a worldmap using IP geolocation.
|
13
|
+
|
14
|
+
* It is a real desktop application, not just a bunch of generated web
|
15
|
+
pages with a clumsy browser-based interface.
|
16
|
+
|
17
|
+
= Installation
|
18
|
+
|
19
|
+
ClickSpotter is written in Ruby[http://www.ruby-lang.org]. It uses the
|
20
|
+
standard Ruby mechanism for distribution. The format is called {Ruby
|
21
|
+
Gems}[http://docs.rubygems.org]. Alternatively, you can install from a
|
22
|
+
tarball using setup.rb.
|
23
|
+
|
24
|
+
This is the first release. Consider it being beta quality right now!
|
25
|
+
|
26
|
+
== Requirements
|
27
|
+
|
28
|
+
Ruby applications are platform independent. There is no need to
|
29
|
+
compile anything. But ClickSpotter has a very small set of
|
30
|
+
dependencies that you have to take care of first. Most Linux version
|
31
|
+
already have them included. Just have sure you have the minimum
|
32
|
+
required version.
|
33
|
+
|
34
|
+
[*Ruby*] ClickSpotter is written in Ruby. You need a Ruby runtime
|
35
|
+
environment to run it. This can be downloaded from
|
36
|
+
RubyForge[http://rubyforge.org]. Most Linux distributions usually have
|
37
|
+
Ruby already included. ClickSpotter currently needs at least version
|
38
|
+
1.8.4. Older version have been reported to show frequent crashes due
|
39
|
+
to what seems to be bugs in the networking libraries.
|
40
|
+
|
41
|
+
[*Qt*] ClickSpotter uses the Qt Toolkit from
|
42
|
+
Trolltech[http://www.trolltech.com]. This toolkit was choosen because
|
43
|
+
it matches the elegance and beauty of Ruby. Almost every Linux
|
44
|
+
distribution has a recent version of Qt included.
|
45
|
+
|
46
|
+
[*qtruby*] To use Qt with Ruby, you also need the qtruby bindings. This is the
|
47
|
+
magic glue that let's Ruby interact with Qt. See {the page on
|
48
|
+
RubyForge}[http://rubyforge.org/projects/korundum] for details. You
|
49
|
+
need at least version 1.0.11.
|
50
|
+
|
51
|
+
[*traceroute*] This is the commandline tool that comes with many Linux
|
52
|
+
distributions. If you don't have it and can't find a
|
53
|
+
distribution package, you can get it at
|
54
|
+
{this site}[http://www.tazenda.demon.co.uk/phil/net-tools].
|
55
|
+
|
56
|
+
[*ClickSpotter*] Get it from the {Download Page}[http://clickspotter.ath.cx/files/Download.html]
|
57
|
+
|
58
|
+
== Installation Process
|
59
|
+
|
60
|
+
Just run as root
|
61
|
+
|
62
|
+
<tt>gem install ClickSpotter-0.1.1.gem</tt>
|
63
|
+
|
64
|
+
to install the gem file. It will install all components of the Gem in
|
65
|
+
the appropriate place.
|
66
|
+
|
67
|
+
See here[http://i.loveruby.net/en/projects/setup/doc/usage.html] for
|
68
|
+
instructions on how to install the tarball. If you use a non-standard
|
69
|
+
prefix or datadir you need to add the path to AppConfig.rb. Otherwise
|
70
|
+
ClickSpotter will not be able to find the worldmap images.
|
71
|
+
|
72
|
+
== Update from previous versions
|
73
|
+
|
74
|
+
Updates work just like the installation.
|
75
|
+
|
76
|
+
<tt>gem update ClickSpotter-0.1.1.gem</tt>
|
77
|
+
|
78
|
+
= Using ClickSpotter
|
79
|
+
|
80
|
+
ClickSpotter's features were wrapped in an easy to use graphical user
|
81
|
+
interface. It does not create an entry in your desktop menu or put an
|
82
|
+
icon on the desktop. You need to start it from the commandline as
|
83
|
+
+clickspotter+. Most other functions should be obvious.
|
84
|
+
|
85
|
+
== Configuring your server log files
|
86
|
+
|
87
|
+
The first thing you need to do is define your log file(s). You need to
|
88
|
+
provide a name, the location of the file and the base URL(s) of your
|
89
|
+
server. The file must be accessible through the local filesystem of
|
90
|
+
the machine that you are running on. If you don't want to run
|
91
|
+
ClickSpotter on your web server or log server, you can use
|
92
|
+
|
93
|
+
<tt>ssh your.web.server tail -f /var/log/apache/my.server-access_log >
|
94
|
+
local_copy.log</tt>
|
95
|
+
|
96
|
+
to get a live copy of your server log on your local machine.
|
97
|
+
|
98
|
+
The log file must be in Apache2 combined log file format. The log
|
99
|
+
entries should look like this:
|
100
|
+
|
101
|
+
<tt>212.114.251.44 - - [18/Jan/2006:16:11:20 +0100] "GET / HTTP/1.1" 200
|
102
|
+
9406 "-" "Mozilla/5.0 (compatible; Konqueror/3.4) KHTML/3.4.2 (like
|
103
|
+
Gecko)"</tt>
|
104
|
+
|
105
|
+
ClickSpotter can only monitor one log at a time. But you can run
|
106
|
+
multiple instances of ClickSpotter. You can pass the name of a log
|
107
|
+
that you have defined when you start ClickSpotter from the command
|
108
|
+
line. Here we assume that you have defined a log file with the name
|
109
|
+
+mylog+.
|
110
|
+
|
111
|
+
<tt>clickspotter mylog</tt>
|
112
|
+
|
113
|
+
== Other settings
|
114
|
+
|
115
|
+
You should also check out the second tab of the configuration dialog.
|
116
|
+
It can be found from the menu under 'Settings' => 'Configure
|
117
|
+
ClickSpotter'.
|
118
|
+
|
119
|
+
The most important setting is the browser launch command. Set this to
|
120
|
+
your favorit browser. The URL of the page is appended to this command
|
121
|
+
to open certain web pages from within ClickSpotter.
|
122
|
+
|
123
|
+
The cache settings are also worth a view. See the peformance section
|
124
|
+
later on for more details on this topic.
|
125
|
+
|
126
|
+
= Geolocation Support
|
127
|
+
|
128
|
+
One of the highlights of ClickSpotter is the Geolocation support. It
|
129
|
+
can not only map your visitors on a world map, but also show the path
|
130
|
+
they took through the Internet to reach your server.
|
131
|
+
|
132
|
+
The Geolocation information is obtained during run-time from
|
133
|
+
hostip.info[http://www.hostip.info]. This is a public Geolocation
|
134
|
+
service. The project that runs this site is still fairly young, so the
|
135
|
+
records are not always correct. You can directly access their database
|
136
|
+
by clicking the 'Correct Data' button or by clicking on the router
|
137
|
+
list view. Please help to improve their database!
|
138
|
+
|
139
|
+
= Performance considerations
|
140
|
+
|
141
|
+
In contrast to most other log analyzer tools, ClickSpotter is
|
142
|
+
amazingly fast. This is certainly a plus for a real-time tool. But it
|
143
|
+
has it's limits. Both the memory consuption as well as the performance
|
144
|
+
of the resolvers can limit the amount of traffic you can monitor. The
|
145
|
+
DNS, Geolocation and Traceroute resolver work asynchronosly in the
|
146
|
+
background. Information is displayed when available, but it does not
|
147
|
+
prevent ClickSpotter from showing other details it already knowns. All
|
148
|
+
screen are updated ever 5s with new information when available.
|
149
|
+
|
150
|
+
= Bugs reports and other feedback
|
151
|
+
|
152
|
+
ClickSpotter was my first Ruby program. I mostly did it to practice my
|
153
|
+
Ruby skills and evaluate the state of Ruby. Since I enjoyed
|
154
|
+
programming Ruby so much I decided to turn it into a releaseable piece
|
155
|
+
of software. But I'm not planning to spend lots of time on turning
|
156
|
+
ClickSpotter into the Swiss Army Knife of log file monitors. I'm open
|
157
|
+
to constructive feedback and patches, but bare with me if I don't find
|
158
|
+
the time to reply.
|
159
|
+
|
160
|
+
= Copyright and License
|
161
|
+
|
162
|
+
ClickSpotter is (c) 2005, 2006 by Chris Schlaeger <cs (at) kde (dot) org>
|
163
|
+
|
164
|
+
This program is free software; you can redistribute it and/or modify
|
165
|
+
it under the terms of version 2 of the GNU General Public License as
|
166
|
+
published by the Free Software Foundation.
|
167
|
+
|
data/bin/clickspotter
ADDED
Binary file
|
data/data/worldmap.png
ADDED
Binary file
|
data/lib/About.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# About.rb - ClickSpotter
|
3
|
+
#
|
4
|
+
# Copyright (c) 2005, 2006 by Chris Schlaeger <cs@kde.org>
|
5
|
+
# This program is free software; you can redistribute it and/or modify
|
6
|
+
# it under the terms of version 2 of the GNU General Public License as
|
7
|
+
# published by the Free Software Foundation.
|
8
|
+
#
|
9
|
+
# $Id: About.rb 8 2006-01-22 15:19:51Z cs $
|
10
|
+
#
|
11
|
+
|
12
|
+
require 'AboutDlg'
|
13
|
+
|
14
|
+
class About < AboutDlg
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
super
|
18
|
+
show
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
data/lib/AboutDlg.rb
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
# Form implementation generated from reading ui file 'AboutDlg.ui'
|
2
|
+
#
|
3
|
+
# Created: Mon Jan 23 23:21:51 2006
|
4
|
+
# by: The QtRuby User Interface Compiler (rbuic)
|
5
|
+
#
|
6
|
+
# WARNING! All changes made in this file will be lost!
|
7
|
+
|
8
|
+
|
9
|
+
require 'Qt'
|
10
|
+
|
11
|
+
class AboutDlg < Qt::Dialog
|
12
|
+
|
13
|
+
attr_reader :tabWidget
|
14
|
+
attr_reader :Widget8
|
15
|
+
attr_reader :aboutVersion
|
16
|
+
attr_reader :Widget9
|
17
|
+
attr_reader :textLabel6
|
18
|
+
attr_reader :TabPage
|
19
|
+
attr_reader :textEdit1
|
20
|
+
attr_reader :buttonOk
|
21
|
+
|
22
|
+
|
23
|
+
def initialize(parent = nil, name = nil, modal = false, fl = 0)
|
24
|
+
super
|
25
|
+
|
26
|
+
if name.nil?
|
27
|
+
setName("AboutDlg")
|
28
|
+
end
|
29
|
+
setSizeGripEnabled(true)
|
30
|
+
|
31
|
+
@AboutDlgLayout = Qt::VBoxLayout.new(self, 11, 6, 'AboutDlgLayout')
|
32
|
+
|
33
|
+
@tabWidget = Qt::TabWidget.new(self, "tabWidget")
|
34
|
+
|
35
|
+
@Widget8 = Qt::Widget.new(@tabWidget, "Widget8")
|
36
|
+
@Widget8Layout = Qt::GridLayout.new(@Widget8, 1, 1, 11, 6, 'Widget8Layout')
|
37
|
+
|
38
|
+
@aboutVersion = Qt::Label.new(@Widget8, "aboutVersion")
|
39
|
+
|
40
|
+
@Widget8Layout.addWidget(@aboutVersion, 0, 0)
|
41
|
+
@tabWidget.insertTab(@Widget8, trUtf8("A&bout"))
|
42
|
+
|
43
|
+
@Widget9 = Qt::Widget.new(@tabWidget, "Widget9")
|
44
|
+
@Widget9Layout = Qt::GridLayout.new(@Widget9, 1, 1, 11, 6, 'Widget9Layout')
|
45
|
+
|
46
|
+
@textLabel6 = Qt::Label.new(@Widget9, "textLabel6")
|
47
|
+
|
48
|
+
@Widget9Layout.addWidget(@textLabel6, 0, 0)
|
49
|
+
@tabWidget.insertTab(@Widget9, trUtf8("&Authors"))
|
50
|
+
|
51
|
+
@TabPage = Qt::Widget.new(@tabWidget, "TabPage")
|
52
|
+
@TabPageLayout = Qt::GridLayout.new(@TabPage, 1, 1, 11, 6, 'TabPageLayout')
|
53
|
+
|
54
|
+
@textEdit1 = Qt::TextEdit.new(@TabPage, "textEdit1")
|
55
|
+
@textEdit1.setTextFormat( Qt::TextEdit::RichText )
|
56
|
+
@textEdit1.setWordWrap( Qt::TextEdit::WidgetWidth )
|
57
|
+
|
58
|
+
@TabPageLayout.addWidget(@textEdit1, 0, 0)
|
59
|
+
@tabWidget.insertTab(@TabPage, trUtf8("License Agreement"))
|
60
|
+
@AboutDlgLayout.addWidget(@tabWidget)
|
61
|
+
|
62
|
+
@Layout1 = Qt::HBoxLayout.new(nil, 0, 6, 'Layout1')
|
63
|
+
@Horizontal_Spacing2 = Qt::SpacerItem.new(20, 20, Qt::SizePolicy::Expanding, Qt::SizePolicy::Minimum)
|
64
|
+
@Layout1.addItem(@Horizontal_Spacing2)
|
65
|
+
|
66
|
+
@buttonOk = Qt::PushButton.new(self, "buttonOk")
|
67
|
+
@buttonOk.setAutoDefault( true )
|
68
|
+
@buttonOk.setDefault( true )
|
69
|
+
@Layout1.addWidget(@buttonOk)
|
70
|
+
@AboutDlgLayout.addLayout(@Layout1)
|
71
|
+
languageChange()
|
72
|
+
resize( Qt::Size.new(566, 432).expandedTo(minimumSizeHint()) )
|
73
|
+
clearWState( WState_Polished )
|
74
|
+
|
75
|
+
Qt::Object.connect(@buttonOk, SIGNAL("clicked()"), self, SLOT("accept()") )
|
76
|
+
end
|
77
|
+
|
78
|
+
#
|
79
|
+
# Sets the strings of the subwidgets using the current
|
80
|
+
# language.
|
81
|
+
#
|
82
|
+
def languageChange()
|
83
|
+
setCaption(trUtf8("About APP_NAME"))
|
84
|
+
@aboutVersion.setText( trUtf8("<p align=\"center\"><b>APP_NAME</b> Version X_X_X</p>\n" +
|
85
|
+
"\n" +
|
86
|
+
"<p align=\"center\"><blockquote>APP_NAME is a real-time log monitor for Apache Web Servers. It allows you to gather more invormation about your visitors and what pages they have visited. It also tells you where in the world they are and how they found your site.</blockquote></p>\n" +
|
87
|
+
"\n" +
|
88
|
+
"<p align=\"center\"><blockquote>APP_NAME uses the GeoLocation Database provided by hostip.info. Please visit <u>http://www.hostip.info</u> for more information.</blockquote></p>") )
|
89
|
+
@tabWidget.changeTab( @Widget8, trUtf8("A&bout") )
|
90
|
+
@textLabel6.setText( trUtf8("<p align=\"center\">ClickSpotter © 2005, 2006 Chris Schlaeger <cs@kde.org></p>\n" +
|
91
|
+
"\n" +
|
92
|
+
"<blockquote>ClickSpotter is written in Ruby and uses the Qt Library and qtruby. Please\n" +
|
93
|
+
"see the respective packages for author, license and copyright information.</blockquote>") )
|
94
|
+
@tabWidget.changeTab( @Widget9, trUtf8("&Authors") )
|
95
|
+
@textEdit1.setText( trUtf8("<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body style=\"font-size:10pt;font-family:Tahoma\">\n" +
|
96
|
+
"<p>This program is distributed under the terms of the GPL v2. </p>\n" +
|
97
|
+
"<p align=\"center\">GNU GENERAL PUBLIC LICENSE<br />Version 2, June 1991 </p>\n" +
|
98
|
+
"<p align=\"center\">Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. </p>\n" +
|
99
|
+
"<p align=\"center\">Preamble </p>\n" +
|
100
|
+
"<p style=\"margin-left:40px;margin-right:40px\">The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. </p>\n" +
|
101
|
+
"<p style=\"margin-left:40px;margin-right:40px\">When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if youwish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. </p>\n" +
|
102
|
+
"<p style=\"margin-left:40px;margin-right:40px\">To protect your rights, we need to make restrictions that forbid anyone to eny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. </p>\n" +
|
103
|
+
"<p style=\"margin-left:40px;margin-right:40px\">For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. </p>\n" +
|
104
|
+
"<p style=\"margin-left:40px;margin-right:40px\">We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. </p>\n" +
|
105
|
+
"<p style=\"margin-left:40px;margin-right:40px\">Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. </p>\n" +
|
106
|
+
"<p style=\"margin-left:40px;margin-right:40px\">Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. </p>\n" +
|
107
|
+
"<p style=\"margin-left:40px;margin-right:40px\">The precise terms and conditions for copying, distribution and modification follow.</p>\n" +
|
108
|
+
"<p align=\"center\">GNU GENERAL PUBLIC LICENSE<br />TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION </p>\n" +
|
109
|
+
"<p style=\"margin-left:40px;margin-right:40px\">0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". </p>\n" +
|
110
|
+
"<p style=\"margin-left:40px;margin-right:40px\">Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. </p>\n" +
|
111
|
+
"<p style=\"margin-left:40px;margin-right:40px\">1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. </p>\n" +
|
112
|
+
"<p style=\"margin-left:40px;margin-right:40px\">You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. </p>\n" +
|
113
|
+
"<p style=\"margin-left:40px;margin-right:40px\">2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: </p>\n" +
|
114
|
+
"<p style=\"margin-left:40px;margin-right:40px\">a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. </p>\n" +
|
115
|
+
"<p style=\"margin-left:40px;margin-right:40px\">b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. </p>\n" +
|
116
|
+
"<p style=\"margin-left:40px;margin-right:40px\">c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) </p>\n" +
|
117
|
+
"<p style=\"margin-left:40px;margin-right:40px\">These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. </p>\n" +
|
118
|
+
"<p style=\"margin-left:40px;margin-right:40px\">Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. </p>\n" +
|
119
|
+
"<p style=\"margin-left:40px;margin-right:40px\">In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. </p>\n" +
|
120
|
+
"<p style=\"margin-left:40px;margin-right:40px\">3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: </p>\n" +
|
121
|
+
"<p style=\"margin-left:40px;margin-right:40px\">a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; </p>\n" +
|
122
|
+
"<p style=\"margin-left:40px;margin-right:40px\">or, </p>\n" +
|
123
|
+
"<p style=\"margin-left:40px;margin-right:40px\">b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, </p>\n" +
|
124
|
+
"<p style=\"margin-left:40px;margin-right:40px\">c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) </p>\n" +
|
125
|
+
"<p style=\"margin-left:40px;margin-right:40px\">The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. </p>\n" +
|
126
|
+
"<p style=\"margin-left:40px;margin-right:40px\">If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. </p>\n" +
|
127
|
+
"<p style=\"margin-left:40px;margin-right:40px\">4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. </p>\n" +
|
128
|
+
"<p style=\"margin-left:40px;margin-right:40px\">5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. </p>\n" +
|
129
|
+
"<p style=\"margin-left:40px;margin-right:40px\">6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. </p>\n" +
|
130
|
+
"<p style=\"margin-left:40px;margin-right:40px\">7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. </p>\n" +
|
131
|
+
"<p style=\"margin-left:40px;margin-right:40px\">If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. </p>\n" +
|
132
|
+
"<p style=\"margin-left:40px;margin-right:40px\">It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. </p>\n" +
|
133
|
+
"<p style=\"margin-left:40px;margin-right:40px\">This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. </p>\n" +
|
134
|
+
"<p style=\"margin-left:40px;margin-right:40px\">8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. </p>\n" +
|
135
|
+
"<p style=\"margin-left:40px;margin-right:40px\">9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. </p>\n" +
|
136
|
+
"<p style=\"margin-left:40px;margin-right:40px\">Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. </p>\n" +
|
137
|
+
"<p style=\"margin-left:40px;margin-right:40px\">10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes</p>\n" +
|
138
|
+
"<p style=\"margin-left:40px;margin-right:40px\">make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. </p>\n" +
|
139
|
+
"<p align=\"center\">NO WARRANTY</p>\n" +
|
140
|
+
"<p style=\"margin-left:40px;margin-right:40px\">11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. </p>\n" +
|
141
|
+
"<p style=\"margin-left:40px;margin-right:40px\">12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. </p>\n" +
|
142
|
+
"<p align=\"center\" style=\"margin-left:40px;margin-right:40px\">END OF TERMS AND CONDITIONS</p>\n" +
|
143
|
+
"<p align=\"center\" style=\"margin-left:40px;margin-right:40px\">How to Apply These Terms to Your New Programs</p>\n" +
|
144
|
+
"<p style=\"margin-left:80px;margin-right:80px\">If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. </p>\n" +
|
145
|
+
"<p style=\"margin-left:80px;margin-right:80px\">To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. </p>\n" +
|
146
|
+
"<p align=\"center\" style=\"margin-left:80px;margin-right:80px\"><span style=\"font-style:italic\">one line to give the program's name and a brief idea of what it does.</span><br />Copyright (C) 19yy <span style=\"font-style:italic\">name of author</span></p>\n" +
|
147
|
+
"<p style=\"margin-left:120px;margin-right:120px\">This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. </p>\n" +
|
148
|
+
"<p style=\"margin-left:120px;margin-right:120px\">This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. </p>\n" +
|
149
|
+
"<p style=\"margin-left:120px;margin-right:120px\">You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA </p>\n" +
|
150
|
+
"<p style=\"margin-left:120px;margin-right:120px\">Also add information on how to contact you by electronic and paper mail. </p>\n" +
|
151
|
+
"<p style=\"margin-left:120px;margin-right:120px\">If the program is interactive, make it output a short notice like this when it starts in an interactive mode: </p>\n" +
|
152
|
+
"<p style=\"margin-left:120px;margin-right:120px\">Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. </p>\n" +
|
153
|
+
"<p style=\"margin-left:120px;margin-right:120px\">The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may</p>\n" +
|
154
|
+
"<p style=\"margin-left:120px;margin-right:120px\">be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. </p>\n" +
|
155
|
+
"<p style=\"margin-left:120px;margin-right:120px\">You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: </p>\n" +
|
156
|
+
"<p style=\"margin-left:120px;margin-right:120px\">Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. </p>\n" +
|
157
|
+
"<p style=\"margin-left:120px;margin-right:120px\">, 1 April 1989 Ty Coon, President of Vice </p>\n" +
|
158
|
+
"<p style=\"margin-left:120px;margin-right:120px\">This General Public License does not permit incorporating your program into</p>\n" +
|
159
|
+
"<p style=\"margin-left:120px;margin-right:120px\">proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. </p>\n" +
|
160
|
+
"</body></html>\n" +
|
161
|
+
"") )
|
162
|
+
@tabWidget.changeTab( @TabPage, trUtf8("License Agreement") )
|
163
|
+
@buttonOk.setText( trUtf8("&OK") )
|
164
|
+
@buttonOk.setAccel( Qt::KeySequence.new(nil) )
|
165
|
+
end
|
166
|
+
protected :languageChange
|
167
|
+
|
168
|
+
|
169
|
+
end
|
data/lib/AppConfig.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
#
|
2
|
+
# AppConfig.rb - ClickSpotter
|
3
|
+
#
|
4
|
+
# Copyright (c) 2005, 2006 by Chris Schlaeger <cs@kde.org>
|
5
|
+
# This program is free software; you can redistribute it and/or modify
|
6
|
+
# it under the terms of version 2 of the GNU General Public License as
|
7
|
+
# published by the Free Software Foundation.
|
8
|
+
#
|
9
|
+
# $Id$
|
10
|
+
#
|
11
|
+
|
12
|
+
require 'rbconfig'
|
13
|
+
|
14
|
+
class AppConfig
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@@version = "0.0.0"
|
18
|
+
@@name = "unnamed"
|
19
|
+
end
|
20
|
+
|
21
|
+
def AppConfig.version=(version)
|
22
|
+
@@version = version
|
23
|
+
end
|
24
|
+
|
25
|
+
def AppConfig.version
|
26
|
+
@@version
|
27
|
+
end
|
28
|
+
|
29
|
+
def AppConfig.name=(name)
|
30
|
+
@@name = name
|
31
|
+
end
|
32
|
+
|
33
|
+
def AppConfig.name
|
34
|
+
@@name
|
35
|
+
end
|
36
|
+
|
37
|
+
def AppConfig.dataDirs
|
38
|
+
siteLibDir = ::Config::CONFIG['sitelibdir']
|
39
|
+
siteBaseDir, rubyVersionDir = siteLibDir.scan(/(.*\/)(.*)/)[0]
|
40
|
+
dirs = []
|
41
|
+
# This is for the development version. We assume that we run the app
|
42
|
+
# from the lib directory.
|
43
|
+
dirs << "../data/"
|
44
|
+
# This hopefully works for all setups. Otherwise we have to add more
|
45
|
+
# alternative pathes.
|
46
|
+
dirs << siteBaseDir + "gems/" + rubyVersionDir + '/gems/' \
|
47
|
+
+ @@name + '-' + @@version + '/data/'
|
48
|
+
dirs << '/usr/share/'
|
49
|
+
dirs << '/usr/local/share/'
|
50
|
+
end
|
51
|
+
|
52
|
+
def AppConfig.dataFiles(fileName)
|
53
|
+
files = []
|
54
|
+
dirs = dataDirs
|
55
|
+
dirs.each { |d| files << d + fileName if File.exist?(d + fileName) }
|
56
|
+
|
57
|
+
files
|
58
|
+
end
|
59
|
+
|
60
|
+
def AppConfig.dataFile(fileName)
|
61
|
+
dirs = dataDirs
|
62
|
+
dirs.each { |d| return d + fileName if File.exist?(d + fileName) }
|
63
|
+
|
64
|
+
nil
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
@@ -0,0 +1,207 @@
|
|
1
|
+
#
|
2
|
+
# AsyncResolverWithCache.rb - ClickSpotter
|
3
|
+
#
|
4
|
+
# Copyright (c) 2005, 2006 by Chris Schlaeger <cs@kde.org>
|
5
|
+
# This program is free software; you can redistribute it and/or modify
|
6
|
+
# it under the terms of version 2 of the GNU General Public License as
|
7
|
+
# published by the Free Software Foundation.
|
8
|
+
#
|
9
|
+
# $Id: AsyncResolverWithCache.rb 10 2006-01-23 14:29:58Z cs $
|
10
|
+
#
|
11
|
+
|
12
|
+
require 'thread'
|
13
|
+
require 'time'
|
14
|
+
require 'GlobalSettings'
|
15
|
+
|
16
|
+
# This class implements a fairly generic asynchronous resolver with persistent
|
17
|
+
# cache. It assumes the information is IP address related, but it's really up
|
18
|
+
# to the subclassing instance to interpret this. The resolver is
|
19
|
+
# multi-threaded and can store the cache in a file.
|
20
|
+
class AsyncResolverWithCache
|
21
|
+
|
22
|
+
attr_accessor :enabled
|
23
|
+
|
24
|
+
def initialize(cacheName, maxAgeInSeconds, maxThreads = 1)
|
25
|
+
|
26
|
+
@cacheName = cacheName
|
27
|
+
@maxAgeInSeconds = maxAgeInSeconds
|
28
|
+
@enabled = true
|
29
|
+
|
30
|
+
# This buffer stores the resolved records. They are hashed by their
|
31
|
+
# IP address.
|
32
|
+
@records = {}
|
33
|
+
# @records can be accessed by the front-end functions as well as the
|
34
|
+
# back-end threads. So we need to lock to avoid access collisions.
|
35
|
+
@recordLock = Mutex.new()
|
36
|
+
|
37
|
+
# The queue stores incoming requests for IPs to be resolved.
|
38
|
+
@queue = Set.new
|
39
|
+
# To store IPs while the resolver threads resolve them.
|
40
|
+
@wip = Set.new
|
41
|
+
# @queue and @wip need to be protected against access collisions.
|
42
|
+
@queueLock = Mutex.new()
|
43
|
+
|
44
|
+
@pause = 1
|
45
|
+
@nextPurge = Time.now
|
46
|
+
|
47
|
+
# Restore already resolved records from persistent storage module.
|
48
|
+
@records = $globals.getSetting(@cacheName)
|
49
|
+
|
50
|
+
# This flag is set to true to terminate the resolver threads.
|
51
|
+
@termFlag = false
|
52
|
+
|
53
|
+
# Start the requested number of resolver threads to service incoming
|
54
|
+
# requests.
|
55
|
+
@threads = []
|
56
|
+
1.upto(maxThreads) { |id| @threads << Thread.new() { processQueueT(id) } }
|
57
|
+
end
|
58
|
+
|
59
|
+
# Stop the resolver threads and save records to disk.
|
60
|
+
def stopAndSave
|
61
|
+
# Signal threads to terminate
|
62
|
+
@termFlag = true
|
63
|
+
|
64
|
+
# Wait until all threads have terminated
|
65
|
+
# Update: Can't do this. It blocks the GUI for too long
|
66
|
+
# @threads.each { |t| t.join }
|
67
|
+
|
68
|
+
# Save cached records to disk
|
69
|
+
@recordLock.lock()
|
70
|
+
$globals.setSetting(@cacheName, @records)
|
71
|
+
@recordLock.unlock()
|
72
|
+
end
|
73
|
+
|
74
|
+
def resolve(ip)
|
75
|
+
@recordLock.lock()
|
76
|
+
|
77
|
+
# Before we resolve new IPs we try to purge outdated ones.
|
78
|
+
if Time.now > @nextPurge
|
79
|
+
deadline = Time.now - @maxAgeInSeconds
|
80
|
+
@records.delete_if { |dummy, r| r.timeStamp < deadline }
|
81
|
+
# We purge every 10 minutes
|
82
|
+
@nextPurge = Time.now + 60 * 10
|
83
|
+
end
|
84
|
+
|
85
|
+
if @records.has_key?(ip)
|
86
|
+
# The record is already in the cache, so we can resolve it immediately.
|
87
|
+
locRec = @records[ip]
|
88
|
+
@recordLock.unlock()
|
89
|
+
return locRec
|
90
|
+
else
|
91
|
+
# The record is not yet known.
|
92
|
+
@recordLock.unlock()
|
93
|
+
|
94
|
+
# In case the resolver is disabled, we don't start any new queries
|
95
|
+
# anymore.
|
96
|
+
return nil unless @enabled
|
97
|
+
|
98
|
+
# There is no point in queuing up endless numbers of requests. They will
|
99
|
+
# be re-requested in case the information is still needed. So we can
|
100
|
+
# safely discard requests when the queue is filled enough.
|
101
|
+
# Otherwise push request on waiting queue if it's not already in there.
|
102
|
+
@queueLock.lock()
|
103
|
+
@queue.add(ip) unless @queue.size >= 200
|
104
|
+
@queueLock.unlock
|
105
|
+
|
106
|
+
# Return nil since we don't have a better answer yet.
|
107
|
+
return nil
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# Returns the size of the waiting queue.
|
112
|
+
def queueSize
|
113
|
+
@queueLock.lock()
|
114
|
+
size = @queue.size
|
115
|
+
@queueLock.unlock()
|
116
|
+
|
117
|
+
size
|
118
|
+
end
|
119
|
+
|
120
|
+
# Flushes the waiting queue.
|
121
|
+
def flushQueue
|
122
|
+
@queueLock.lock()
|
123
|
+
@queue.clear
|
124
|
+
@queueLock.unlock()
|
125
|
+
end
|
126
|
+
|
127
|
+
# Returns the number of stored (resolved) records in the database.
|
128
|
+
def cacheSize
|
129
|
+
@recordLock.lock()
|
130
|
+
size = @records.size
|
131
|
+
@recordLock.unlock()
|
132
|
+
|
133
|
+
size
|
134
|
+
end
|
135
|
+
|
136
|
+
# This function can be used to adjust the expiration time of the record
|
137
|
+
# corresponding to the ip address. The record will expire 'minutes' from
|
138
|
+
# now.
|
139
|
+
def expireInMinutes(ip, minutes)
|
140
|
+
return unless rec = @records[ip]
|
141
|
+
|
142
|
+
rec.timeStamp = Time.now + @maxAgeInSeconds - minutes * 60
|
143
|
+
end
|
144
|
+
|
145
|
+
private
|
146
|
+
|
147
|
+
# This is the main-loop function of the resolver. It runs in its own
|
148
|
+
# thread, so it does not block other parts of the program.
|
149
|
+
def processQueueT(id)
|
150
|
+
while true
|
151
|
+
@queueLock.lock()
|
152
|
+
if @queue.empty?
|
153
|
+
# If there are no requests to be resolved, we just sleep a while.
|
154
|
+
@queueLock.unlock()
|
155
|
+
return if @termFlag
|
156
|
+
sleep(@pause)
|
157
|
+
else
|
158
|
+
# Find one ip in the queue that is not already work in progress of
|
159
|
+
# another thread. If no ip is found, sleep a bit.
|
160
|
+
ip = nil
|
161
|
+
@queue.each do |i|
|
162
|
+
next if @wip.include?(i)
|
163
|
+
@wip.add(ip = i)
|
164
|
+
break
|
165
|
+
end
|
166
|
+
@queueLock.unlock()
|
167
|
+
|
168
|
+
if ip
|
169
|
+
resolveNow(ip)
|
170
|
+
else
|
171
|
+
return if @termFlag
|
172
|
+
sleep(@pause)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# This function is used by the resolver threads to synchronosly resolve the
|
179
|
+
# information related to the ip address. The resolved information is stored
|
180
|
+
# in the record database.
|
181
|
+
def resolveNow(ip)
|
182
|
+
rec = newRecord()
|
183
|
+
if rec.resolve(ip)
|
184
|
+
@recordLock.lock()
|
185
|
+
@records[ip] = rec
|
186
|
+
@recordLock.unlock()
|
187
|
+
|
188
|
+
# Now we can remove the ip from the queue
|
189
|
+
@queueLock.lock()
|
190
|
+
@queue.delete(ip)
|
191
|
+
@wip.delete(ip)
|
192
|
+
@queueLock.unlock()
|
193
|
+
|
194
|
+
# Any successful lookup immediately sets the pause back to 1
|
195
|
+
# second.
|
196
|
+
@pause = 1
|
197
|
+
else
|
198
|
+
# In case the lookup failed we increase the pause between
|
199
|
+
# lookups gradualy to a maximum of about 10 minutes. This
|
200
|
+
# prevents excessive lookup attempts when there is an obvious
|
201
|
+
# problem with the network or the server.
|
202
|
+
@pause *= 2 if @pause < 600
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
end
|
207
|
+
|