cirrocumulus 0.2.6 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.6
1
+ 0.2.8
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cirrocumulus}
8
- s.version = "0.2.6"
8
+ s.version = "0.2.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Anton Kosyakin"]
12
- s.date = %q{2011-09-27}
12
+ s.date = %q{2011-10-11}
13
13
  s.description = %q{Engine for building your own agents, providing you base functionality for loading ontologies, communicating with other agents and parsing FIPA-ACL messages}
14
14
  s.email = %q{deil@mneko.net}
15
15
  s.extra_rdoc_files = [
@@ -82,16 +82,7 @@ class Cirrocumulus
82
82
  end
83
83
 
84
84
  def run(agent, kb, sniff = false)
85
- suffix = agent.default_ontology ? agent.default_ontology.gsub('cirrocumulus-', '') : @suffix
86
- @jid = if @generate_jid
87
- _, hostname = systemu 'hostname'
88
- hostname.strip!
89
- "%s-%s" % [hostname, suffix]
90
- else
91
- suffix
92
- end
93
- Log4r::Logger['cirrocumulus'].info "logging as " + @jid
94
- connect()
85
+ connect(generate_jid(agent))
95
86
 
96
87
  Log4r::Logger['cirrocumulus'].info("entering main loop")
97
88
  agent.restore_state()
@@ -102,9 +93,10 @@ class Cirrocumulus
102
93
  kb.collect_knowledge()
103
94
 
104
95
  begin
105
- connect() if @im.nil? || !@im.connected?
96
+ connect(generate_jid(agent)) if @im.nil? || !@im.connected?
106
97
  rescue Exception => e
107
98
  puts e.to_s
99
+ sleep 5
108
100
  end
109
101
 
110
102
  next if @im.nil? || !@im.connected?
@@ -149,7 +141,21 @@ class Cirrocumulus
149
141
 
150
142
  private
151
143
 
152
- def connect()
144
+ def generate_jid(agent)
145
+ suffix = agent.default_ontology ? agent.default_ontology.gsub('cirrocumulus-', '') : @suffix
146
+ if @generate_jid
147
+ _, hostname = systemu 'hostname'
148
+ hostname.strip!
149
+ "%s-%s" % [hostname, suffix]
150
+ else
151
+ suffix
152
+ end
153
+ end
154
+
155
+ def connect(jid)
156
+ @jid = jid
157
+ Log4r::Logger['cirrocumulus'].info "logging as " + @jid
158
+
153
159
  begin
154
160
  @im.disconnect if @im && @im.connected?
155
161
  full_jid = @jid + "@" + JABBER_SERVER
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cirrocumulus
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 6
10
- version: 0.2.6
9
+ - 8
10
+ version: 0.2.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Anton Kosyakin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-27 00:00:00 +04:00
18
+ date: 2011-10-11 00:00:00 +04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency