14 #include "socks5bytestream.h"
15 #include "bytestreamdatahandler.h"
16 #include "clientbase.h"
17 #include "connectionbase.h"
18 #include "connectionsocks5proxy.h"
25 SOCKS5Bytestream::SOCKS5Bytestream( SOCKS5BytestreamManager* manager, ConnectionBase* connection,
26 LogSink& logInstance,
const JID& initiator,
const JID& target,
27 const std::string& sid )
28 : Bytestream( Bytestream::S5B, logInstance, initiator, target, sid ),
29 m_manager( manager ), m_connection( 0 ), m_socks5( 0 ), m_connected( false )
34 setConnectionImpl( connection );
51 m_connection = connection;
62 if( !m_connection || !m_socks5 || !m_manager )
68 StreamHostList::const_iterator it = m_hosts.begin();
69 for( ; it != m_hosts.end(); ++it )
71 if( ++it == m_hosts.end() )
74 m_connection->
setServer( (*it).host, (*it).port );
89 if( !
m_open || !m_connection || !m_socks5 || !m_manager )
92 return m_socks5->
send( data );
97 if( !m_connection || !m_socks5 || !m_manager )
100 return m_socks5->
recv( timeout );
103 void SOCKS5Bytestream::activate()
146 m_manager->acknowledgeStreamHost(
true, m_proxy,
m_sid );