mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-06 21:58:57 -04:00
Updated tests for tcponudp. Only some of these tests are still valid.
the TOU interface no longer supports multiple sockets.. all the connections are attached to the same UdpStack. Multiple sockets will be re-introduced in the next TOU iteration. At that point the remaining tests will be fixed up. * tweaked regress.mk * added scripts to launch tests. * replaced UdpLayer with UdpStacks. * only two proper tests: udp_server (passes), test_tou (fails) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4341 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
3c19218bec
commit
4e56166e3f
9 changed files with 94 additions and 64 deletions
|
@ -27,17 +27,18 @@
|
|||
|
||||
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
|
||||
//#define USE_TCP_SOCKET
|
||||
|
||||
// for printing sockaddr
|
||||
#include "udplayer.h"
|
||||
#include "udp/udpstack.h"
|
||||
|
||||
#ifndef USE_TCP_SOCKET
|
||||
#include "tou.h"
|
||||
#include "tcponudp/tou.h"
|
||||
#endif
|
||||
|
||||
#include "tou_net.h"
|
||||
#include "util/bdnet.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -99,8 +100,6 @@ int main(int argc, char **argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
tounet_init();
|
||||
|
||||
/* setup the local/remote addresses.
|
||||
*/
|
||||
struct sockaddr_in laddr;
|
||||
|
@ -109,8 +108,8 @@ int main(int argc, char **argv)
|
|||
laddr.sin_family = AF_INET;
|
||||
raddr.sin_family = AF_INET;
|
||||
|
||||
if ((!tounet_inet_aton(argv[optind], &(laddr.sin_addr))) ||
|
||||
(!tounet_inet_aton(argv[optind+2], &(raddr.sin_addr))))
|
||||
if ((!bdnet_inet_aton(argv[optind], &(laddr.sin_addr))) ||
|
||||
(!bdnet_inet_aton(argv[optind+2], &(raddr.sin_addr))))
|
||||
{
|
||||
std::cerr << "Invalid addresses!" << std::endl;
|
||||
usage(argv[0]);
|
||||
|
@ -122,6 +121,9 @@ 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);
|
||||
|
@ -284,8 +286,8 @@ int main(int argc, char **argv)
|
|||
char data[bufsize];
|
||||
int readsize = 0;
|
||||
|
||||
tounet_fcntl(0, F_SETFL, O_NONBLOCK);
|
||||
tounet_fcntl(1,F_SETFL,O_NONBLOCK);
|
||||
bdnet_fcntl(0, F_SETFL, O_NONBLOCK);
|
||||
bdnet_fcntl(1,F_SETFL,O_NONBLOCK);
|
||||
|
||||
bool doneWrite = false;
|
||||
bool doneRead = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue