summaryrefslogtreecommitdiff
path: root/classes/Net/SSH/Multi/PendingConnection.html
blob: 42a4f2f4ba5452c13b2851c540a4ce25d4f02eb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
  <head>
    <title>Net::SSH::Multi::PendingConnection</title>
    <meta content='text/html; charset=US-ASCII' http-equiv='Content-Type'>
    <link href='../../../../css/style.css' media='screen' rel='stylesheet' type='text/css'>
    <script type='text/javascript'>
      //<![CDATA[
        function popupCode(url) {
          window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
        }
        
        function toggleCode(id) {
          var code = document.getElementById(id)
        
          code.style.display = code.style.display != 'block' ? 'block' : 'none'
          return true
        }
        
        // Make codeblocks hidden by default
        document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
      //]]>
    </script>
  </head>
  <body class='page'>
    <div class='class' id='wrapper'>
      <div class='header'>
        <h1 class='name'>
          <span class='type'>class</span>
          Net::SSH::Multi::PendingConnection
        </h1>
        <ol class='paths'>
          <li>
            <a target="docwin" href="../../../../files/lib/net/ssh/multi/pending_connection_rb.html">lib/net/ssh/multi/pending_connection.rb</a>
          </li>
        </ol>
        <div class='parent'>
          Parent:
          <strong><a target="docwin" href="../Multi.html">Multi</a></strong>
        </div>
      </div>
      <div id='content'>
        <div id='text'>
          <div id='description'>
            
            <p>A <a href="PendingConnection.html">PendingConnection</a> instance mimics a
            Net::SSH::Connection::Session instance, without actually being an open
            connection to a server. It is used by <a
            href="Session.html">Net::SSH::Multi::Session</a> when a concurrent
            connection limit is in effect, so that a server can hang on to a
            "connection" that isn't really a connection.</p>
            
            <p>Any requests against this connection (like <a
            href="PendingConnection.html#method-i-open_channel">open_channel</a> or <a
            href="PendingConnection.html#method-i-send_global_request">send_global_request</a>)
            are not actually sent, but are added to a list of recordings. When the real
            session is opened and replaces this pending connection, all recorded
            actions will be replayed against that session.</p>
            
            <p>You'll never need to initialize one of these directly, and (if all goes
            well!) should never even notice that one of these is in use. <a
            href="Session.html">Net::SSH::Multi::Session</a> will instantiate these as
            needed, and only when there is a concurrent connection limit.</p>
          </div>
          <div id='method-list'>
            <h2>Methods</h2>
            <h3>Public Class</h3>
            <ol>
              <li><a target="docwin" href="#method-c-new">new</a></li>
            </ol>
            <h3>Public Instance</h3>
            <ol>
              <li><a target="docwin" href="#method-i-busy-3F">busy?</a></li>
              <li><a target="docwin" href="#method-i-channels">channels</a></li>
              <li><a target="docwin" href="#method-i-close">close</a></li>
              <li><a target="docwin" href="#method-i-listeners">listeners</a></li>
              <li><a target="docwin" href="#method-i-open_channel">open_channel</a></li>
              <li><a target="docwin" href="#method-i-postprocess">postprocess</a></li>
              <li><a target="docwin" href="#method-i-preprocess">preprocess</a></li>
              <li><a target="docwin" href="#method-i-replace_with">replace_with</a></li>
              <li><a target="docwin" href="#method-i-send_global_request">send_global_request</a></li>
              <li><a target="docwin" href="#attribute-i-server">server</a></li>
            </ol>
          </div>
          <div id='context'>
          </div>
          <div id='section'>
            <div id='attribute-list'>
              <h2 class='section-bar'>Attributes</h2>
              <div class='name-list'>
                <table>
                  <tr class='top-aligned-row context-row'>
                    <td class='context-item-name'>
                      <a name='attribute-i-server'>server</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'>
                      
                      <p>The <a href="Server.html">Net::SSH::Multi::Server</a> object that "owns"
                      this pending connection.</p>
                    </td>
                  </tr>
                </table>
              </div>
            </div>
            <div id='methods'>
              <h2>Public Class methods</h2>
              <div class='method public-class' id='method-method-c-new'>
                <a name='method-c-new'></a>
                <div class='synopsis'>
                  <span class='name'>new</span>
                  <span class='arguments'>(server)</span>
                </div>
                <div class='description'>
                  
                  <p>Instantiates a new pending connection for the given <a
                  href="Server.html">Net::SSH::Multi::Server</a> object.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-c-new-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-c-new-source'><span class="ruby-comment"># File lib/net/ssh/multi/pending_connection.rb, line 52</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">server</span>)&#x000A;  <span class="ruby-ivar">@server</span> = <span class="ruby-identifier">server</span>&#x000A;  <span class="ruby-ivar">@recordings</span> = []&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <h2>Public Instance methods</h2>
              <div class='method public-instance' id='method-method-i-busy-3F'>
                <a name='method-i-busy-3F'></a>
                <div class='synopsis'>
                  <span class='name'>busy?</span>
                  <span class='arguments'>(include_invisible=false)</span>
                </div>
                <div class='description'>
                  
                  <p>Always returns <tt>true</tt>, so that the pending connection looks active
                  until it can be truly opened and replaced with a real connection.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-busy-3F-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-busy-3F-source'><span class="ruby-comment"># File lib/net/ssh/multi/pending_connection.rb, line 82</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">busy?</span>(<span class="ruby-identifier">include_invisible</span>=<span class="ruby-keyword">false</span>)&#x000A;  <span class="ruby-keyword">true</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-channels'>
                <a name='method-i-channels'></a>
                <div class='synopsis'>
                  <span class='name'>channels</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                  <p>Returns an empty array, since a pending connection cannot have any real
                  channels.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-channels-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-channels-source'><span class="ruby-comment"># File lib/net/ssh/multi/pending_connection.rb, line 92</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">channels</span>&#x000A;  []&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-close'>
                <a name='method-i-close'></a>
                <div class='synopsis'>
                  <span class='name'>close</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                  <p>Does nothing, except to make a pending connection quack like a real
                  connection.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-close-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-close-source'><span class="ruby-comment"># File lib/net/ssh/multi/pending_connection.rb, line 87</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">close</span>&#x000A;  <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-listeners'>
                <a name='method-i-listeners'></a>
                <div class='synopsis'>
                  <span class='name'>listeners</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                  <p>Returns an empty hash, since a pending connection has no real listeners.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-listeners-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-listeners-source'><span class="ruby-comment"># File lib/net/ssh/multi/pending_connection.rb, line 107</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">listeners</span>&#x000A;  {}&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-open_channel'>
                <a name='method-i-open_channel'></a>
                <div class='synopsis'>
                  <span class='name'>open_channel</span>
                  <span class='arguments'>(type="session", *extras, &on_confirm)</span>
                </div>
                <div class='description'>
                  
                  <p>Records that a channel open request has been made, and returns a new <a
                  href="ChannelProxy.html">Net::SSH::Multi::ChannelProxy</a> object to
                  represent the (as yet unopened) channel.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-open_channel-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-open_channel-source'><span class="ruby-comment"># File lib/net/ssh/multi/pending_connection.rb, line 67</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">open_channel</span>(<span class="ruby-identifier">type</span>=<span class="ruby-string">&quot;session&quot;</span>, *<span class="ruby-identifier">extras</span>, &amp;<span class="ruby-identifier">on_confirm</span>)&#x000A;  <span class="ruby-identifier">channel</span> = <span class="ruby-constant">ChannelProxy</span>.<span class="ruby-identifier">new</span>(&amp;<span class="ruby-identifier">on_confirm</span>)&#x000A;  <span class="ruby-ivar">@recordings</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">ChannelOpenRecording</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">extras</span>, <span class="ruby-identifier">channel</span>)&#x000A;  <span class="ruby-keyword">return</span> <span class="ruby-identifier">channel</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-postprocess'>
                <a name='method-i-postprocess'></a>
                <div class='synopsis'>
                  <span class='name'>postprocess</span>
                  <span class='arguments'>(readers, writers)</span>
                </div>
                <div class='description'>
                  
                  <p>Returns <tt>true</tt>, and does nothing else.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-postprocess-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-postprocess-source'><span class="ruby-comment"># File lib/net/ssh/multi/pending_connection.rb, line 102</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">postprocess</span>(<span class="ruby-identifier">readers</span>, <span class="ruby-identifier">writers</span>)&#x000A;  <span class="ruby-keyword">true</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-preprocess'>
                <a name='method-i-preprocess'></a>
                <div class='synopsis'>
                  <span class='name'>preprocess</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                  <p>Returns <tt>true</tt>, and does nothing else.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-preprocess-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-preprocess-source'><span class="ruby-comment"># File lib/net/ssh/multi/pending_connection.rb, line 97</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">preprocess</span>&#x000A;  <span class="ruby-keyword">true</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-replace_with'>
                <a name='method-i-replace_with'></a>
                <div class='synopsis'>
                  <span class='name'>replace_with</span>
                  <span class='arguments'>(session)</span>
                </div>
                <div class='description'>
                  
                  <p>Instructs the pending session to replay all of its recordings against the
                  given <tt>session</tt>, and to then replace itself with the given session.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-replace_with-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-replace_with-source'><span class="ruby-comment"># File lib/net/ssh/multi/pending_connection.rb, line 59</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">replace_with</span>(<span class="ruby-identifier">session</span>)&#x000A;  <span class="ruby-ivar">@recordings</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">recording</span><span class="ruby-operator">|</span> <span class="ruby-identifier">recording</span>.<span class="ruby-identifier">replay_on</span>(<span class="ruby-identifier">session</span>) }&#x000A;  <span class="ruby-ivar">@server</span>.<span class="ruby-identifier">replace_session</span>(<span class="ruby-identifier">session</span>)&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-send_global_request'>
                <a name='method-i-send_global_request'></a>
                <div class='synopsis'>
                  <span class='name'>send_global_request</span>
                  <span class='arguments'>(type, *extra, &callback)</span>
                </div>
                <div class='description'>
                  
                  <p>Records that a global request has been made. The request is not actually
                  sent, and won't be until <a
                  href="PendingConnection.html#method-i-replace_with">replace_with</a> is
                  called.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-send_global_request-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-send_global_request-source'><span class="ruby-comment"># File lib/net/ssh/multi/pending_connection.rb, line 75</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">send_global_request</span>(<span class="ruby-identifier">type</span>, *<span class="ruby-identifier">extra</span>, &amp;<span class="ruby-identifier">callback</span>)&#x000A;  <span class="ruby-ivar">@recordings</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">SendGlobalRequestRecording</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">extra</span>, <span class="ruby-identifier">callback</span>)&#x000A;  <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div id='footer-push'></div>
    </div>
    <div id='footer'>
      <a target="docwin" href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
    </div>
  </body>
</html>