Class Jabber::Bytestreams::SOCKS5BytestreamsTarget
In: lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb
Parent: SOCKS5Bytestreams
XMLStanza Message Presence Iq REXML::Element X IqQuery Error StreamHost IqSiFileRange IqSiFile StreamHostUsed IqSi XRosterItem RosterItem IqFeature XMUCUserItem XMUCUserInvite XDataField XDataReported XDataTitle XDataInstructions Feature Identity Item IqVcard Singleton IdGenerator Connection Client Component Comparable JID RuntimeError AuthenticationFailure ErrorException SOCKS5Error Stream SOCKS5Bytestreams SOCKS5BytestreamsTarget SOCKS5BytestreamsInitiator SOCKS5BytestreamsServerStreamHost TCPSocket SOCKS5Socket IBB IBBTarget IBBInitiator IqQuery IqQueryBytestreams IqQueryVersion IqQueryRoster IqQueryDiscoItems IqQueryDiscoInfo Responder SimpleResponder X XRoster XMUCUser XMUC XDelay XData MUCClient SimpleMUCClient Base DigestMD5 Plain FileSource StreamParser SOCKS5BytestreamsPeer SOCKS5BytestreamsServer IBBQueueItem Helper MUCBrowser Helper Helper lib/xmpp4r/authenticationfailure.rb lib/xmpp4r/idgenerator.rb lib/xmpp4r/connection.rb lib/xmpp4r/iq.rb lib/xmpp4r/jid.rb lib/xmpp4r/xmlstanza.rb lib/xmpp4r/errorexception.rb lib/xmpp4r/stream.rb lib/xmpp4r/client.rb lib/xmpp4r/x.rb lib/xmpp4r/streamparser.rb lib/xmpp4r/error.rb lib/xmpp4r/component.rb lib/xmpp4r/query.rb lib/xmpp4r/message.rb lib/xmpp4r/presence.rb lib/xmpp4r/bytestreams/helper/ibb/initiator.rb lib/xmpp4r/bytestreams/iq/si.rb lib/xmpp4r/bytestreams/iq/bytestreams.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb lib/xmpp4r/bytestreams/helper/ibb/base.rb lib/xmpp4r/bytestreams/helper/ibb/target.rb Bytestreams lib/xmpp4r/version/iq/version.rb lib/xmpp4r/version/helper/responder.rb lib/xmpp4r/version/helper/simpleresponder.rb Version lib/xmpp4r/roster/helper/roster.rb lib/xmpp4r/roster/iq/roster.rb lib/xmpp4r/roster/x/roster.rb Roster lib/xmpp4r/feature_negotiation/iq/feature.rb FeatureNegotiation lib/xmpp4r/muc/x/muc.rb lib/xmpp4r/muc/helper/mucclient.rb lib/xmpp4r/muc/x/mucuseritem.rb lib/xmpp4r/muc/helper/mucbrowser.rb lib/xmpp4r/muc/x/mucuserinvite.rb lib/xmpp4r/muc/helper/simplemucclient.rb MUC lib/xmpp4r/sasl.rb SASL lib/xmpp4r/bytestreams/helper/filetransfer.rb TransferSource FileTransfer lib/xmpp4r/delay/x/delay.rb Delay lib/xmpp4r/dataforms/x/data.rb Dataforms lib/xmpp4r/discovery/iq/discoinfo.rb lib/xmpp4r/discovery/iq/discoitems.rb Discovery lib/xmpp4r/vcard/helper/vcard.rb lib/xmpp4r/vcard/iq/vcard.rb Vcard Jabber dot/m_60_0.png

SOCKS5 Bytestreams implementation of the target site

Methods

accept  

Public Instance methods

Wait until the stream has been established

May raise various exceptions

[Source]

    # File lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb, line 10
10:       def accept
11:         error = nil
12:         connect_lock = Mutex.new
13:         connect_lock.lock
14: 
15:         @stream.add_iq_callback(200, self) { |iq|
16:           if iq.type == :set and iq.from == @initiator_jid and iq.to == @target_jid and iq.query.kind_of?(IqQueryBytestreams)
17:             begin
18:               @stream.delete_iq_callback(self)
19: 
20:               iq.query.each_element('streamhost') { |streamhost|
21:                 if streamhost.host and streamhost.port and not @socks
22:                   begin
23:                     @socks = connect_socks(streamhost)
24:                     @streamhost_used = streamhost
25:                   rescue Exception => e
26:                     Jabber::debuglog("SOCKS5 Bytestreams: #{e.class}: #{e}\n#{e.backtrace.join("\n")}")
27:                     @streamhost_cbs.process(streamhost, :failure, e)
28:                   end
29:                 end
30:               }
31: 
32:               reply = iq.answer(false)
33:               if @streamhost_used
34:                 reply.type = :result
35:                 reply.add(IqQueryBytestreams.new)
36:                 reply.query.add(StreamHostUsed.new(@streamhost_used.jid))
37:               else
38:                 reply.type = :error
39:                 reply.add(Error.new('item-not-found'))
40:               end
41:               @stream.send(reply)
42:             rescue Exception => e
43:               error = e
44:             end
45:               
46:             connect_lock.unlock
47:             true
48:           else
49:             false
50:           end
51:         }
52: 
53:         connect_lock.lock
54:         connect_lock.unlock
55:         raise error if error
56:         (@socks != nil)
57:       end

[Validate]