journeta 0.1.7 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/Gemfile +8 -0
  2. data/Gemfile.lock +20 -0
  3. data/{History.txt → HISTORY} +13 -1
  4. data/LICENSE +51 -0
  5. data/License.txt +2 -2
  6. data/{README.txt → README.rdoc} +12 -17
  7. data/Rakefile +46 -112
  8. data/VERSION +1 -0
  9. data/{examples/instant_messenger.rb → bin/journeta_instant_messenger.rb} +13 -0
  10. data/bin/journeta_mock_peers.rb +32 -0
  11. data/{examples/network_status.rb → bin/journeta_network_status.rb} +0 -0
  12. data/bin/journeta_peer_fuzzer.rb +54 -0
  13. data/{examples/queue_client.rb → bin/journeta_queue_client.rb} +0 -0
  14. data/{examples/queue_server.rb → bin/journeta_queue_server.rb} +0 -0
  15. data/bin/journeta_thread_leak_check.rb +16 -0
  16. data/bin/journeta_top.rb +73 -0
  17. data/{examples/instant_messenger_gui.rb → broken/journeta_instant_messenger_gui.rb} +0 -2
  18. data/broken/journeta_instant_messenger_shoes.rb +52 -0
  19. data/lib/diff.rb +280 -0
  20. data/lib/journeta.rb +1 -0
  21. data/lib/journeta/asynchronous.rb +2 -2
  22. data/lib/journeta/exception.rb +8 -0
  23. data/lib/journeta/journeta_engine.rb +4 -5
  24. data/lib/journeta/logger.rb +1 -1
  25. data/lib/journeta/peer_connection.rb +2 -2
  26. data/lib/journeta/peer_listener.rb +2 -2
  27. data/lib/journeta/presence_broadcaster.rb +19 -5
  28. data/lib/journeta/presence_listener.rb +8 -4
  29. data/lib/journeta/version.rb +6 -4
  30. data/rdoc/Array.html +199 -0
  31. data/rdoc/Diff.html +714 -0
  32. data/rdoc/Diffable.html +409 -0
  33. data/rdoc/Journeta.html +288 -0
  34. data/rdoc/Journeta/Asynchronous.html +429 -0
  35. data/rdoc/Journeta/Common.html +205 -0
  36. data/rdoc/Journeta/Common/BasicMessage.html +228 -0
  37. data/rdoc/Journeta/Common/DummyPeerHandler.html +237 -0
  38. data/rdoc/Journeta/Common/Job.html +279 -0
  39. data/rdoc/Journeta/Common/Shutdown.html +236 -0
  40. data/rdoc/Journeta/DefaultPeerHandler.html +248 -0
  41. data/rdoc/Journeta/DefaultPeerRegisteredHandler.html +249 -0
  42. data/rdoc/Journeta/DefaultPeerUnregisteredHandler.html +249 -0
  43. data/rdoc/Journeta/DefaultPeerUpdatedHandler.html +249 -0
  44. data/rdoc/Journeta/Engine.html +953 -0
  45. data/rdoc/Journeta/Logger.html +237 -0
  46. data/rdoc/Journeta/NotImplementedException.html +188 -0
  47. data/rdoc/Journeta/PeerConnection.html +549 -0
  48. data/rdoc/Journeta/PeerListener.html +276 -0
  49. data/rdoc/Journeta/PeerRegistry.html +804 -0
  50. data/rdoc/Journeta/PresenceBroadcaster.html +306 -0
  51. data/rdoc/Journeta/PresenceListener.html +300 -0
  52. data/rdoc/Journeta/PresenceMessage.html +321 -0
  53. data/rdoc/Journeta/VERSION.html +181 -0
  54. data/rdoc/README_rdoc.html +196 -0
  55. data/rdoc/String.html +199 -0
  56. data/rdoc/created.rid +20 -0
  57. data/rdoc/index.html +212 -0
  58. data/rdoc/lib/diff_rb.html +52 -0
  59. data/rdoc/lib/journeta/asynchronous_rb.html +60 -0
  60. data/rdoc/lib/journeta/common/basic_message_rb.html +52 -0
  61. data/rdoc/lib/journeta/common/dummy_peer_handler_rb.html +52 -0
  62. data/rdoc/lib/journeta/common/job_rb.html +52 -0
  63. data/rdoc/lib/journeta/common/shutdown_rb.html +52 -0
  64. data/rdoc/lib/journeta/exception_rb.html +55 -0
  65. data/rdoc/lib/journeta/journeta_engine_rb.html +62 -0
  66. data/rdoc/lib/journeta/logger_rb.html +55 -0
  67. data/rdoc/lib/journeta/peer_connection_rb.html +58 -0
  68. data/rdoc/lib/journeta/peer_handler_rb.html +52 -0
  69. data/rdoc/lib/journeta/peer_listener_rb.html +60 -0
  70. data/rdoc/lib/journeta/peer_registry_rb.html +54 -0
  71. data/rdoc/lib/journeta/presence_broadcaster_rb.html +57 -0
  72. data/rdoc/lib/journeta/presence_listener_rb.html +62 -0
  73. data/rdoc/lib/journeta/presence_message_rb.html +52 -0
  74. data/rdoc/lib/journeta/version_rb.html +52 -0
  75. data/rdoc/lib/journeta_rb.html +91 -0
  76. data/rdoc/rdoc.css +706 -0
  77. data/test/helper.rb +19 -0
  78. data/test/test_lifecycle.rb +49 -9
  79. data/website/images/arrow.png +0 -0
  80. data/website/images/banner.jpg +0 -0
  81. data/website/images/content_shadow.png +0 -0
  82. data/website/images/content_side.png +0 -0
  83. data/website/images/header.jpg +0 -0
  84. data/website/images/header_side.jpg +0 -0
  85. data/website/index.html +1 -1
  86. data/website/index.txt +1 -1
  87. data/website/stylesheets/reset.css +30 -0
  88. data/website/stylesheets/screen.css +1 -1
  89. metadata +152 -46
  90. data/test/test_event_broadcaster.rb +0 -15
  91. data/test/test_helper.rb +0 -4
  92. data/test/test_journeta.rb +0 -11
@@ -0,0 +1,237 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
+
8
+ <title>Module: Journeta::Logger</title>
9
+
10
+ <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="../js/jquery.js" type="text/javascript"
13
+ charset="utf-8"></script>
14
+ <script src="../js/thickbox-compressed.js" type="text/javascript"
15
+ charset="utf-8"></script>
16
+ <script src="../js/quicksearch.js" type="text/javascript"
17
+ charset="utf-8"></script>
18
+ <script src="../js/darkfish.js" type="text/javascript"
19
+ charset="utf-8"></script>
20
+
21
+ </head>
22
+ <body class="module">
23
+
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="../index.html">Home</a>
29
+ <a href="../index.html#classes">Classes</a>
30
+ <a href="../index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="file-metadata">
36
+ <div id="file-list-section" class="section">
37
+ <h3 class="section-header">In Files</h3>
38
+ <div class="section-body">
39
+ <ul>
40
+
41
+ <li><a href="../lib/journeta/logger_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
+ class="thickbox" title="lib/journeta/logger.rb">lib/journeta/logger.rb</a></li>
43
+
44
+ </ul>
45
+ </div>
46
+ </div>
47
+
48
+
49
+ </div>
50
+
51
+ <div id="class-metadata">
52
+
53
+ <!-- Parent Class -->
54
+
55
+
56
+ <!-- Namespace Contents -->
57
+
58
+
59
+ <!-- Method Quickref -->
60
+
61
+ <div id="method-list-section" class="section">
62
+ <h3 class="section-header">Methods</h3>
63
+ <ul class="link-list">
64
+
65
+ <li><a href="#method-i-putsd">#putsd</a></li>
66
+
67
+ </ul>
68
+ </div>
69
+
70
+
71
+ <!-- Included Modules -->
72
+
73
+ </div>
74
+
75
+ <div id="project-metadata">
76
+
77
+
78
+ <div id="fileindex-section" class="section project-section">
79
+ <h3 class="section-header">Files</h3>
80
+ <ul>
81
+
82
+ <li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
83
+
84
+ </ul>
85
+ </div>
86
+
87
+
88
+ <div id="classindex-section" class="section project-section">
89
+ <h3 class="section-header">Class Index
90
+ <span class="search-toggle"><img src="../images/find.png"
91
+ height="16" width="16" alt="[+]"
92
+ title="show/hide quicksearch" /></span></h3>
93
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
94
+ <fieldset>
95
+ <legend>Quicksearch</legend>
96
+ <input type="text" name="quicksearch" value=""
97
+ class="quicksearch-field" />
98
+ </fieldset>
99
+ </form>
100
+
101
+ <ul class="link-list">
102
+
103
+ <li><a href="../Journeta/Asynchronous.html">Journeta::Asynchronous</a></li>
104
+
105
+ <li><a href="../Journeta/Common.html">Journeta::Common</a></li>
106
+
107
+ <li><a href="../Journeta/Common/BasicMessage.html">Journeta::Common::BasicMessage</a></li>
108
+
109
+ <li><a href="../Journeta/Common/DummyPeerHandler.html">Journeta::Common::DummyPeerHandler</a></li>
110
+
111
+ <li><a href="../Journeta/Common/Job.html">Journeta::Common::Job</a></li>
112
+
113
+ <li><a href="../Journeta/Common/Shutdown.html">Journeta::Common::Shutdown</a></li>
114
+
115
+ <li><a href="../Journeta/DefaultPeerHandler.html">Journeta::DefaultPeerHandler</a></li>
116
+
117
+ <li><a href="../Journeta/DefaultPeerRegisteredHandler.html">Journeta::DefaultPeerRegisteredHandler</a></li>
118
+
119
+ <li><a href="../Journeta/DefaultPeerUnregisteredHandler.html">Journeta::DefaultPeerUnregisteredHandler</a></li>
120
+
121
+ <li><a href="../Journeta/DefaultPeerUpdatedHandler.html">Journeta::DefaultPeerUpdatedHandler</a></li>
122
+
123
+ <li><a href="../Journeta/Engine.html">Journeta::Engine</a></li>
124
+
125
+ <li><a href="../Journeta/Logger.html">Journeta::Logger</a></li>
126
+
127
+ <li><a href="../Journeta/NotImplementedException.html">Journeta::NotImplementedException</a></li>
128
+
129
+ <li><a href="../Journeta/PeerConnection.html">Journeta::PeerConnection</a></li>
130
+
131
+ <li><a href="../Journeta/PeerListener.html">Journeta::PeerListener</a></li>
132
+
133
+ <li><a href="../Journeta/PeerRegistry.html">Journeta::PeerRegistry</a></li>
134
+
135
+ <li><a href="../Journeta/PresenceBroadcaster.html">Journeta::PresenceBroadcaster</a></li>
136
+
137
+ <li><a href="../Journeta/PresenceListener.html">Journeta::PresenceListener</a></li>
138
+
139
+ <li><a href="../Journeta/PresenceMessage.html">Journeta::PresenceMessage</a></li>
140
+
141
+ <li><a href="../Array.html">Array</a></li>
142
+
143
+ <li><a href="../Diff.html">Diff</a></li>
144
+
145
+ <li><a href="../Diffable.html">Diffable</a></li>
146
+
147
+ <li><a href="../String.html">String</a></li>
148
+
149
+ </ul>
150
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
151
+ </div>
152
+
153
+
154
+ </div>
155
+ </div>
156
+
157
+ <div id="documentation">
158
+ <h1 class="module">Journeta::Logger</h1>
159
+
160
+ <div id="description">
161
+ <p>
162
+ A silly logging implementation intended for internal use only. Nothing to
163
+ see here!
164
+ </p>
165
+
166
+ </div>
167
+
168
+ <!-- Constants -->
169
+
170
+
171
+ <!-- Attributes -->
172
+
173
+
174
+ <!-- Methods -->
175
+
176
+ <div id="public-instance-method-details" class="method-section section">
177
+ <h3 class="section-header">Public Instance Methods</h3>
178
+
179
+
180
+ <div id="putsd-method" class="method-detail ">
181
+ <a name="method-i-putsd"></a>
182
+
183
+ <div class="method-heading">
184
+
185
+ <span class="method-name">putsd</span><span
186
+ class="method-args">(message = '(no message)')</span>
187
+ <span class="method-click-advice">click to toggle source</span>
188
+
189
+ </div>
190
+
191
+ <div class="method-description">
192
+
193
+ <p>
194
+ A thread safe method for printing the given string if and only if debugging
195
+ is enabled.
196
+ </p>
197
+
198
+
199
+
200
+ <div class="method-source-code"
201
+ id="putsd-source">
202
+ <pre>
203
+ <span class="ruby-comment cmt"># File lib/journeta/logger.rb, line 10</span>
204
+ 10: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">putsd</span>(<span class="ruby-identifier">message</span> = <span class="ruby-value str">'(no message)'</span>)
205
+ 11: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">print</span>(<span class="ruby-node">&quot;DEBUG: #{message}\n&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
206
+ 12: <span class="ruby-keyword kw">end</span></pre>
207
+ </div>
208
+
209
+ </div>
210
+
211
+
212
+
213
+
214
+ </div>
215
+
216
+
217
+ </div>
218
+
219
+
220
+ </div>
221
+
222
+
223
+ <div id="rdoc-debugging-section-dump" class="debugging-section">
224
+
225
+ <p>Disabled; run with --debug to generate this.</p>
226
+
227
+ </div>
228
+
229
+ <div id="validator-badges">
230
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
231
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
232
+ Rdoc Generator</a> 1.1.6</small>.</p>
233
+ </div>
234
+
235
+ </body>
236
+ </html>
237
+
@@ -0,0 +1,188 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: Journeta::NotImplementedException</title>
9
+
10
+ <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="../js/jquery.js" type="text/javascript"
13
+ charset="utf-8"></script>
14
+ <script src="../js/thickbox-compressed.js" type="text/javascript"
15
+ charset="utf-8"></script>
16
+ <script src="../js/quicksearch.js" type="text/javascript"
17
+ charset="utf-8"></script>
18
+ <script src="../js/darkfish.js" type="text/javascript"
19
+ charset="utf-8"></script>
20
+
21
+ </head>
22
+ <body class="class">
23
+
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="../index.html">Home</a>
29
+ <a href="../index.html#classes">Classes</a>
30
+ <a href="../index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="file-metadata">
36
+ <div id="file-list-section" class="section">
37
+ <h3 class="section-header">In Files</h3>
38
+ <div class="section-body">
39
+ <ul>
40
+
41
+ <li><a href="../lib/journeta/exception_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
+ class="thickbox" title="lib/journeta/exception.rb">lib/journeta/exception.rb</a></li>
43
+
44
+ </ul>
45
+ </div>
46
+ </div>
47
+
48
+
49
+ </div>
50
+
51
+ <div id="class-metadata">
52
+
53
+ <!-- Parent Class -->
54
+
55
+ <div id="parent-class-section" class="section">
56
+ <h3 class="section-header">Parent</h3>
57
+
58
+ <p class="link">Exception</p>
59
+
60
+ </div>
61
+
62
+
63
+ <!-- Namespace Contents -->
64
+
65
+
66
+ <!-- Method Quickref -->
67
+
68
+
69
+ <!-- Included Modules -->
70
+
71
+ </div>
72
+
73
+ <div id="project-metadata">
74
+
75
+
76
+ <div id="fileindex-section" class="section project-section">
77
+ <h3 class="section-header">Files</h3>
78
+ <ul>
79
+
80
+ <li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
81
+
82
+ </ul>
83
+ </div>
84
+
85
+
86
+ <div id="classindex-section" class="section project-section">
87
+ <h3 class="section-header">Class Index
88
+ <span class="search-toggle"><img src="../images/find.png"
89
+ height="16" width="16" alt="[+]"
90
+ title="show/hide quicksearch" /></span></h3>
91
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
92
+ <fieldset>
93
+ <legend>Quicksearch</legend>
94
+ <input type="text" name="quicksearch" value=""
95
+ class="quicksearch-field" />
96
+ </fieldset>
97
+ </form>
98
+
99
+ <ul class="link-list">
100
+
101
+ <li><a href="../Journeta/Asynchronous.html">Journeta::Asynchronous</a></li>
102
+
103
+ <li><a href="../Journeta/Common.html">Journeta::Common</a></li>
104
+
105
+ <li><a href="../Journeta/Common/BasicMessage.html">Journeta::Common::BasicMessage</a></li>
106
+
107
+ <li><a href="../Journeta/Common/DummyPeerHandler.html">Journeta::Common::DummyPeerHandler</a></li>
108
+
109
+ <li><a href="../Journeta/Common/Job.html">Journeta::Common::Job</a></li>
110
+
111
+ <li><a href="../Journeta/Common/Shutdown.html">Journeta::Common::Shutdown</a></li>
112
+
113
+ <li><a href="../Journeta/DefaultPeerHandler.html">Journeta::DefaultPeerHandler</a></li>
114
+
115
+ <li><a href="../Journeta/DefaultPeerRegisteredHandler.html">Journeta::DefaultPeerRegisteredHandler</a></li>
116
+
117
+ <li><a href="../Journeta/DefaultPeerUnregisteredHandler.html">Journeta::DefaultPeerUnregisteredHandler</a></li>
118
+
119
+ <li><a href="../Journeta/DefaultPeerUpdatedHandler.html">Journeta::DefaultPeerUpdatedHandler</a></li>
120
+
121
+ <li><a href="../Journeta/Engine.html">Journeta::Engine</a></li>
122
+
123
+ <li><a href="../Journeta/Logger.html">Journeta::Logger</a></li>
124
+
125
+ <li><a href="../Journeta/NotImplementedException.html">Journeta::NotImplementedException</a></li>
126
+
127
+ <li><a href="../Journeta/PeerConnection.html">Journeta::PeerConnection</a></li>
128
+
129
+ <li><a href="../Journeta/PeerListener.html">Journeta::PeerListener</a></li>
130
+
131
+ <li><a href="../Journeta/PeerRegistry.html">Journeta::PeerRegistry</a></li>
132
+
133
+ <li><a href="../Journeta/PresenceBroadcaster.html">Journeta::PresenceBroadcaster</a></li>
134
+
135
+ <li><a href="../Journeta/PresenceListener.html">Journeta::PresenceListener</a></li>
136
+
137
+ <li><a href="../Journeta/PresenceMessage.html">Journeta::PresenceMessage</a></li>
138
+
139
+ <li><a href="../Array.html">Array</a></li>
140
+
141
+ <li><a href="../Diff.html">Diff</a></li>
142
+
143
+ <li><a href="../Diffable.html">Diffable</a></li>
144
+
145
+ <li><a href="../String.html">String</a></li>
146
+
147
+ </ul>
148
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
149
+ </div>
150
+
151
+
152
+ </div>
153
+ </div>
154
+
155
+ <div id="documentation">
156
+ <h1 class="class">Journeta::NotImplementedException</h1>
157
+
158
+ <div id="description">
159
+
160
+ </div>
161
+
162
+ <!-- Constants -->
163
+
164
+
165
+ <!-- Attributes -->
166
+
167
+
168
+ <!-- Methods -->
169
+
170
+
171
+ </div>
172
+
173
+
174
+ <div id="rdoc-debugging-section-dump" class="debugging-section">
175
+
176
+ <p>Disabled; run with --debug to generate this.</p>
177
+
178
+ </div>
179
+
180
+ <div id="validator-badges">
181
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
182
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
183
+ Rdoc Generator</a> 1.1.6</small>.</p>
184
+ </div>
185
+
186
+ </body>
187
+ </html>
188
+
@@ -0,0 +1,549 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: Journeta::PeerConnection</title>
9
+
10
+ <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="../js/jquery.js" type="text/javascript"
13
+ charset="utf-8"></script>
14
+ <script src="../js/thickbox-compressed.js" type="text/javascript"
15
+ charset="utf-8"></script>
16
+ <script src="../js/quicksearch.js" type="text/javascript"
17
+ charset="utf-8"></script>
18
+ <script src="../js/darkfish.js" type="text/javascript"
19
+ charset="utf-8"></script>
20
+
21
+ </head>
22
+ <body class="class">
23
+
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="../index.html">Home</a>
29
+ <a href="../index.html#classes">Classes</a>
30
+ <a href="../index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="file-metadata">
36
+ <div id="file-list-section" class="section">
37
+ <h3 class="section-header">In Files</h3>
38
+ <div class="section-body">
39
+ <ul>
40
+
41
+ <li><a href="../lib/journeta/peer_connection_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
+ class="thickbox" title="lib/journeta/peer_connection.rb">lib/journeta/peer_connection.rb</a></li>
43
+
44
+ </ul>
45
+ </div>
46
+ </div>
47
+
48
+
49
+ </div>
50
+
51
+ <div id="class-metadata">
52
+
53
+ <!-- Parent Class -->
54
+
55
+ <div id="parent-class-section" class="section">
56
+ <h3 class="section-header">Parent</h3>
57
+
58
+ <p class="link"><a href="Asynchronous.html">Journeta::Asynchronous</a></p>
59
+
60
+ </div>
61
+
62
+
63
+ <!-- Namespace Contents -->
64
+
65
+
66
+ <!-- Method Quickref -->
67
+
68
+ <div id="method-list-section" class="section">
69
+ <h3 class="section-header">Methods</h3>
70
+ <ul class="link-list">
71
+
72
+ <li><a href="#method-c-new">::new</a></li>
73
+
74
+ <li><a href="#method-i-go">#go</a></li>
75
+
76
+ <li><a href="#method-i-send_payload">#send_payload</a></li>
77
+
78
+ <li><a href="#method-i-update_settings">#update_settings</a></li>
79
+
80
+ </ul>
81
+ </div>
82
+
83
+
84
+ <!-- Included Modules -->
85
+
86
+ <div id="includes-section" class="section">
87
+ <h3 class="section-header">Included Modules</h3>
88
+ <ul class="link-list">
89
+
90
+
91
+ <li><span class="include">Logger</span></li>
92
+
93
+
94
+ </ul>
95
+ </div>
96
+
97
+ </div>
98
+
99
+ <div id="project-metadata">
100
+
101
+
102
+ <div id="fileindex-section" class="section project-section">
103
+ <h3 class="section-header">Files</h3>
104
+ <ul>
105
+
106
+ <li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
107
+
108
+ </ul>
109
+ </div>
110
+
111
+
112
+ <div id="classindex-section" class="section project-section">
113
+ <h3 class="section-header">Class Index
114
+ <span class="search-toggle"><img src="../images/find.png"
115
+ height="16" width="16" alt="[+]"
116
+ title="show/hide quicksearch" /></span></h3>
117
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
118
+ <fieldset>
119
+ <legend>Quicksearch</legend>
120
+ <input type="text" name="quicksearch" value=""
121
+ class="quicksearch-field" />
122
+ </fieldset>
123
+ </form>
124
+
125
+ <ul class="link-list">
126
+
127
+ <li><a href="../Journeta/Asynchronous.html">Journeta::Asynchronous</a></li>
128
+
129
+ <li><a href="../Journeta/Common.html">Journeta::Common</a></li>
130
+
131
+ <li><a href="../Journeta/Common/BasicMessage.html">Journeta::Common::BasicMessage</a></li>
132
+
133
+ <li><a href="../Journeta/Common/DummyPeerHandler.html">Journeta::Common::DummyPeerHandler</a></li>
134
+
135
+ <li><a href="../Journeta/Common/Job.html">Journeta::Common::Job</a></li>
136
+
137
+ <li><a href="../Journeta/Common/Shutdown.html">Journeta::Common::Shutdown</a></li>
138
+
139
+ <li><a href="../Journeta/DefaultPeerHandler.html">Journeta::DefaultPeerHandler</a></li>
140
+
141
+ <li><a href="../Journeta/DefaultPeerRegisteredHandler.html">Journeta::DefaultPeerRegisteredHandler</a></li>
142
+
143
+ <li><a href="../Journeta/DefaultPeerUnregisteredHandler.html">Journeta::DefaultPeerUnregisteredHandler</a></li>
144
+
145
+ <li><a href="../Journeta/DefaultPeerUpdatedHandler.html">Journeta::DefaultPeerUpdatedHandler</a></li>
146
+
147
+ <li><a href="../Journeta/Engine.html">Journeta::Engine</a></li>
148
+
149
+ <li><a href="../Journeta/Logger.html">Journeta::Logger</a></li>
150
+
151
+ <li><a href="../Journeta/NotImplementedException.html">Journeta::NotImplementedException</a></li>
152
+
153
+ <li><a href="../Journeta/PeerConnection.html">Journeta::PeerConnection</a></li>
154
+
155
+ <li><a href="../Journeta/PeerListener.html">Journeta::PeerListener</a></li>
156
+
157
+ <li><a href="../Journeta/PeerRegistry.html">Journeta::PeerRegistry</a></li>
158
+
159
+ <li><a href="../Journeta/PresenceBroadcaster.html">Journeta::PresenceBroadcaster</a></li>
160
+
161
+ <li><a href="../Journeta/PresenceListener.html">Journeta::PresenceListener</a></li>
162
+
163
+ <li><a href="../Journeta/PresenceMessage.html">Journeta::PresenceMessage</a></li>
164
+
165
+ <li><a href="../Array.html">Array</a></li>
166
+
167
+ <li><a href="../Diff.html">Diff</a></li>
168
+
169
+ <li><a href="../Diffable.html">Diffable</a></li>
170
+
171
+ <li><a href="../String.html">String</a></li>
172
+
173
+ </ul>
174
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
175
+ </div>
176
+
177
+
178
+ </div>
179
+ </div>
180
+
181
+ <div id="documentation">
182
+ <h1 class="class">Journeta::PeerConnection</h1>
183
+
184
+ <div id="description">
185
+ <p>
186
+ An outgoing message tube. Messages may or may not arrive at the
187
+ destination, but if they do they&#8217;ll be in order.
188
+ </p>
189
+
190
+ </div>
191
+
192
+ <!-- Constants -->
193
+
194
+
195
+ <!-- Attributes -->
196
+
197
+ <div id="attribute-method-details" class="method-section section">
198
+ <h3 class="section-header">Attributes</h3>
199
+
200
+
201
+ <div id="uuid-attribute-method" class="method-detail">
202
+ <a name="uuid"></a>
203
+
204
+ <a name="uuid="></a>
205
+
206
+ <div class="method-heading attribute-method-heading">
207
+ <span class="method-name">uuid</span><span
208
+ class="attribute-access-type">[RW]</span>
209
+ </div>
210
+
211
+ <div class="method-description">
212
+
213
+ <p>
214
+ <a href="../String.html">String</a>
215
+ </p>
216
+
217
+ </div>
218
+ </div>
219
+
220
+ <div id="ip-address-attribute-method" class="method-detail">
221
+ <a name="ip_address"></a>
222
+
223
+ <a name="ip_address="></a>
224
+
225
+ <div class="method-heading attribute-method-heading">
226
+ <span class="method-name">ip_address</span><span
227
+ class="attribute-access-type">[RW]</span>
228
+ </div>
229
+
230
+ <div class="method-description">
231
+
232
+
233
+
234
+ </div>
235
+ </div>
236
+
237
+ <div id="version-attribute-method" class="method-detail">
238
+ <a name="version"></a>
239
+
240
+ <a name="version="></a>
241
+
242
+ <div class="method-heading attribute-method-heading">
243
+ <span class="method-name">version</span><span
244
+ class="attribute-access-type">[RW]</span>
245
+ </div>
246
+
247
+ <div class="method-description">
248
+
249
+
250
+
251
+ </div>
252
+ </div>
253
+
254
+ <div id="groups-attribute-method" class="method-detail">
255
+ <a name="groups"></a>
256
+
257
+ <a name="groups="></a>
258
+
259
+ <div class="method-heading attribute-method-heading">
260
+ <span class="method-name">groups</span><span
261
+ class="attribute-access-type">[RW]</span>
262
+ </div>
263
+
264
+ <div class="method-description">
265
+
266
+ <p>
267
+ An <a href="../Array.html">Array</a> of Strings.
268
+ </p>
269
+
270
+ </div>
271
+ </div>
272
+
273
+ <div id="created-at-attribute-method" class="method-detail">
274
+ <a name="created_at"></a>
275
+
276
+ <a name="created_at="></a>
277
+
278
+ <div class="method-heading attribute-method-heading">
279
+ <span class="method-name">created_at</span><span
280
+ class="attribute-access-type">[RW]</span>
281
+ </div>
282
+
283
+ <div class="method-description">
284
+
285
+ <p>
286
+ Time.
287
+ </p>
288
+
289
+ </div>
290
+ </div>
291
+
292
+ <div id="updated-at-attribute-method" class="method-detail">
293
+ <a name="updated_at"></a>
294
+
295
+ <a name="updated_at="></a>
296
+
297
+ <div class="method-heading attribute-method-heading">
298
+ <span class="method-name">updated_at</span><span
299
+ class="attribute-access-type">[RW]</span>
300
+ </div>
301
+
302
+ <div class="method-description">
303
+
304
+
305
+
306
+ </div>
307
+ </div>
308
+
309
+ <div id="peer-port-attribute-method" class="method-detail">
310
+ <a name="peer_port"></a>
311
+
312
+ <a name="peer_port="></a>
313
+
314
+ <div class="method-heading attribute-method-heading">
315
+ <span class="method-name">peer_port</span><span
316
+ class="attribute-access-type">[RW]</span>
317
+ </div>
318
+
319
+ <div class="method-description">
320
+
321
+ <p>
322
+ integer.
323
+ </p>
324
+
325
+ </div>
326
+ </div>
327
+
328
+ </div>
329
+
330
+
331
+ <!-- Methods -->
332
+
333
+ <div id="public-class-method-details" class="method-section section">
334
+ <h3 class="section-header">Public Class Methods</h3>
335
+
336
+
337
+ <div id="new-method" class="method-detail ">
338
+ <a name="method-c-new"></a>
339
+
340
+ <div class="method-heading">
341
+
342
+ <span class="method-name">new</span><span
343
+ class="method-args">(engine)</span>
344
+ <span class="method-click-advice">click to toggle source</span>
345
+
346
+ </div>
347
+
348
+ <div class="method-description">
349
+
350
+
351
+
352
+
353
+
354
+ <div class="method-source-code"
355
+ id="new-source">
356
+ <pre>
357
+ <span class="ruby-comment cmt"># File lib/journeta/peer_connection.rb, line 27</span>
358
+ 27: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">engine</span>)
359
+ 28: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">engine</span>)
360
+ 29: <span class="ruby-ivar">@queue</span> = <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">new</span>
361
+ 30: <span class="ruby-ivar">@settings_lock</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span>
362
+ 31: <span class="ruby-keyword kw">end</span></pre>
363
+ </div>
364
+
365
+ </div>
366
+
367
+
368
+
369
+
370
+ </div>
371
+
372
+
373
+ </div>
374
+
375
+ <div id="public-instance-method-details" class="method-section section">
376
+ <h3 class="section-header">Public Instance Methods</h3>
377
+
378
+
379
+ <div id="go-method" class="method-detail ">
380
+ <a name="method-i-go"></a>
381
+
382
+ <div class="method-heading">
383
+
384
+ <span class="method-name">go</span><span
385
+ class="method-args">()</span>
386
+ <span class="method-click-advice">click to toggle source</span>
387
+
388
+ </div>
389
+
390
+ <div class="method-description">
391
+
392
+ <p>
393
+ Implementation of abstract parent declaration.
394
+ </p>
395
+
396
+
397
+
398
+ <div class="method-source-code"
399
+ id="go-source">
400
+ <pre>
401
+ <span class="ruby-comment cmt"># File lib/journeta/peer_connection.rb, line 57</span>
402
+ 57: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">go</span>
403
+ 58: <span class="ruby-keyword kw">begin</span>
404
+ 59: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
405
+ 60: <span class="ruby-comment cmt"># TODO Reuse TCP connections between pops!</span>
406
+ 61: <span class="ruby-identifier">payload</span> = <span class="ruby-ivar">@queue</span>.<span class="ruby-identifier">pop</span>
407
+ 62: <span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">nil</span>
408
+ 63: <span class="ruby-ivar">@settings_lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span> <span class="ruby-comment cmt"># To prevent corruption of settings.</span>
409
+ 64: <span class="ruby-identifier">s</span> = <span class="ruby-constant">TCPSocket</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ip_address</span>, <span class="ruby-identifier">peer_port</span>)
410
+ 65: <span class="ruby-keyword kw">end</span>
411
+ 66: <span class="ruby-identifier">data</span> = <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">dump</span>(<span class="ruby-identifier">payload</span>)
412
+ 67: <span class="ruby-comment cmt"># pp data</span>
413
+ 68: <span class="ruby-identifier">s</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">data</span> , <span class="ruby-value">0</span>)
414
+ 69: <span class="ruby-identifier">s</span>.<span class="ruby-identifier">close</span>
415
+ 70: <span class="ruby-keyword kw">end</span>
416
+ 71: <span class="ruby-keyword kw">rescue</span>
417
+ 72: <span class="ruby-comment cmt"># Ok, so this is kindof wierd.</span>
418
+ 73: <span class="ruby-comment cmt"># Unregistering ourselves in our own thread is a paradox becasue</span>
419
+ 74: <span class="ruby-comment cmt"># we'd end up killing ourselves before the call completes and the unregistration process can finish.</span>
420
+ 75: <span class="ruby-comment cmt"># The end effect being we could end up with a stopped peer connection which is still registered.</span>
421
+ 76: <span class="ruby-comment cmt"># So to kill ourselves cleanly, we need to create *another* thread exclusively for the task.</span>
422
+ 77: <span class="ruby-comment cmt"># If somehow we end up in this block again before our child thread kills us, we're ok to create another one</span>
423
+ 78: <span class="ruby-comment cmt"># because the registry will just ignore a request to unregister an unknown connection, and it's internally</span>
424
+ 79: <span class="ruby-comment cmt"># protected against registry corruption with an exclusive lock.</span>
425
+ 80: <span class="ruby-comment cmt">#</span>
426
+ 81: <span class="ruby-comment cmt"># Sorry that this is deceptively complicated. It's a design gotcha! :)</span>
427
+ 82: <span class="ruby-identifier">putsd</span> <span class="ruby-node">&quot;Peer #{uuid} has gone away. Deregistering in the background.&quot;</span>
428
+ 83: <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">me</span><span class="ruby-operator">|</span>
429
+ 84: <span class="ruby-ivar">@engine</span>.<span class="ruby-identifier">unregister_peer</span>(<span class="ruby-identifier">me</span>)
430
+ 85: <span class="ruby-keyword kw">end</span>
431
+ 86: <span class="ruby-keyword kw">end</span>
432
+ 87: <span class="ruby-keyword kw">end</span></pre>
433
+ </div>
434
+
435
+ </div>
436
+
437
+
438
+
439
+
440
+ </div>
441
+
442
+
443
+ <div id="send-payload-method" class="method-detail ">
444
+ <a name="method-i-send_payload"></a>
445
+
446
+ <div class="method-heading">
447
+
448
+ <span class="method-name">send_payload</span><span
449
+ class="method-args">(payload)</span>
450
+ <span class="method-click-advice">click to toggle source</span>
451
+
452
+ </div>
453
+
454
+ <div class="method-description">
455
+
456
+ <p>
457
+ Adds the given payload to the outbound message queue and immediately
458
+ returns.
459
+ </p>
460
+
461
+
462
+
463
+ <div class="method-source-code"
464
+ id="send-payload-source">
465
+ <pre>
466
+ <span class="ruby-comment cmt"># File lib/journeta/peer_connection.rb, line 34</span>
467
+ 34: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_payload</span>(<span class="ruby-identifier">payload</span>)
468
+ 35: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Don't try to send nil payloads!&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">payload</span>.<span class="ruby-identifier">nil?</span>
469
+ 36: <span class="ruby-ivar">@queue</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">payload</span>
470
+ 37: <span class="ruby-keyword kw">end</span></pre>
471
+ </div>
472
+
473
+ </div>
474
+
475
+
476
+
477
+
478
+ </div>
479
+
480
+
481
+ <div id="update-settings-method" class="method-detail ">
482
+ <a name="method-i-update_settings"></a>
483
+
484
+ <div class="method-heading">
485
+
486
+ <span class="method-name">update_settings</span><span
487
+ class="method-args">(other)</span>
488
+ <span class="method-click-advice">click to toggle source</span>
489
+
490
+ </div>
491
+
492
+ <div class="method-description">
493
+
494
+ <p>
495
+ Updates this instances settings by copying from a provided template. Peers
496
+ can, in theory, change IP address, port, version and group settings without
497
+ re-registering in this instance, which would drop all pending outbound data
498
+ from this connection queue, and the creation and registration of a new
499
+ connection record. Peer metadata of this instance will be updated from the
500
+ same fields of the given instance, however, the internal queue of this
501
+ instance and current thread I/O context will remain unchanged.
502
+ </p>
503
+
504
+
505
+
506
+ <div class="method-source-code"
507
+ id="update-settings-source">
508
+ <pre>
509
+ <span class="ruby-comment cmt"># File lib/journeta/peer_connection.rb, line 46</span>
510
+ 46: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_settings</span>(<span class="ruby-identifier">other</span>)
511
+ 47: <span class="ruby-ivar">@settings_lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
512
+ 48: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ip_address</span> = <span class="ruby-identifier">other</span>.<span class="ruby-identifier">ip_address</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">ip_address</span>
513
+ 49: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">peer_port</span> = <span class="ruby-identifier">other</span>.<span class="ruby-identifier">peer_port</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">peer_port</span>
514
+ 50: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">version</span> = <span class="ruby-identifier">other</span>.<span class="ruby-identifier">version</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">version</span>
515
+ 51: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">created_at</span> = <span class="ruby-identifier">other</span>.<span class="ruby-identifier">created_at</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">created_at</span>
516
+ 52: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">updated_at</span> = <span class="ruby-identifier">other</span>.<span class="ruby-identifier">updated_at</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">updated_at</span>
517
+ 53: <span class="ruby-keyword kw">end</span>
518
+ 54: <span class="ruby-keyword kw">end</span></pre>
519
+ </div>
520
+
521
+ </div>
522
+
523
+
524
+
525
+
526
+ </div>
527
+
528
+
529
+ </div>
530
+
531
+
532
+ </div>
533
+
534
+
535
+ <div id="rdoc-debugging-section-dump" class="debugging-section">
536
+
537
+ <p>Disabled; run with --debug to generate this.</p>
538
+
539
+ </div>
540
+
541
+ <div id="validator-badges">
542
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
543
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
544
+ Rdoc Generator</a> 1.1.6</small>.</p>
545
+ </div>
546
+
547
+ </body>
548
+ </html>
549
+