From 6722fa24c501ee05fd3e2a29d993e200da97c722 Mon Sep 17 00:00:00 2001 From: drbob Date: Tue, 19 Jul 2011 22:23:33 +0000 Subject: [PATCH] repaired regression tests. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4477 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/tests/tcponudp/test_tou.cc | 21 ++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/libretroshare/src/tests/tcponudp/test_tou.cc b/libretroshare/src/tests/tcponudp/test_tou.cc index 70fc89b12..17035f631 100644 --- a/libretroshare/src/tests/tcponudp/test_tou.cc +++ b/libretroshare/src/tests/tcponudp/test_tou.cc @@ -29,13 +29,14 @@ #include #include -//#define USE_TCP_SOCKET +//#define USE_TCP_SOCKET 1 // for printing sockaddr #include "udp/udpstack.h" #ifndef USE_TCP_SOCKET #include "tcponudp/tou.h" + #include "tcponudp/udppeer.h" #endif /* shouldn't do this - but for convenience @@ -132,13 +133,25 @@ int main(int argc, char **argv) std::cerr << "Local Address: " << laddr << std::endl; std::cerr << "Remote Address: " << raddr << std::endl; - UdpStack udps(laddr); - tou_init((void *) &udps); + + #ifdef USE_TCP_SOCKET int sockfd = socket(PF_INET, SOCK_STREAM, 0); #else - int sockfd = tou_socket(PF_INET, SOCK_STREAM, 0); + + UdpStack udps(laddr); + + UdpSubReceiver *udpReceivers[1]; + int udpTypes[1]; + + udpReceivers[0] = new UdpPeerReceiver(&udps); + udpTypes[0] = TOU_RECEIVER_TYPE_UDPPEER; + udps.addReceiver(udpReceivers[0]); + + tou_init((void **) udpReceivers, udpTypes, 1); + + int sockfd = tou_socket(0, TOU_RECEIVER_TYPE_UDPPEER, 0); #endif if (sockfd < 0) {