socket_type fix

This commit is contained in:
Arvid Norberg 2009-11-26 15:56:20 +00:00
parent 50366107d6
commit c6333e147c
1 changed files with 29 additions and 0 deletions

View File

@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_SOCKET_TYPE
#define TORRENT_SOCKET_TYPE
#include "libtorrent/config.hpp"
#include "libtorrent/socket.hpp"
#include "libtorrent/socks5_stream.hpp"
#include "libtorrent/http_stream.hpp"
@ -41,6 +42,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/max.hpp"
#include "libtorrent/assert.hpp"
#if TORRENT_USE_I2P
#define TORRENT_SOCKTYPE_FORWARD(x) \
switch (m_type) { \
case socket_type_int_impl<stream_socket>::value: \
@ -67,6 +70,32 @@ POSSIBILITY OF SUCH DAMAGE.
default: TORRENT_ASSERT(false); return def; \
}
#else // TORRENT_USE_I2P
#define TORRENT_SOCKTYPE_FORWARD(x) \
switch (m_type) { \
case socket_type_int_impl<stream_socket>::value: \
get<stream_socket>()->x; break; \
case socket_type_int_impl<socks5_stream>::value: \
get<socks5_stream>()->x; break; \
case socket_type_int_impl<http_stream>::value: \
get<http_stream>()->x; break; \
default: TORRENT_ASSERT(false); \
}
#define TORRENT_SOCKTYPE_FORWARD_RET(x, def) \
switch (m_type) { \
case socket_type_int_impl<stream_socket>::value: \
return get<stream_socket>()->x; \
case socket_type_int_impl<socks5_stream>::value: \
return get<socks5_stream>()->x; \
case socket_type_int_impl<http_stream>::value: \
return get<http_stream>()->x; \
default: TORRENT_ASSERT(false); return def; \
}
#endif // TORRENT_USE_I2P
namespace libtorrent
{