From 7ec2d1c53b753238509bf7a89587509305b9216d Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Sun, 19 Oct 2008 20:06:14 +0000 Subject: move to asio socket libary for sync bugs / todos: * new connections don't sync * anyrtpproxy broken * anytun-controlld doesn't send data --- src/Sockets/tests/retry.cpp | 67 --------------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 src/Sockets/tests/retry.cpp (limited to 'src/Sockets/tests/retry.cpp') diff --git a/src/Sockets/tests/retry.cpp b/src/Sockets/tests/retry.cpp deleted file mode 100644 index 36954a6..0000000 --- a/src/Sockets/tests/retry.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include -#include - - - bool quit = false; - -/* - virtual bool OnConnectRetry(); -- void SetRetryClientConnect(bool x = true); -- bool RetryClientConnect(); - void SetConnectionRetry(int n); - int GetConnectionRetry(); - void IncreaseConnectionRetries(); - int GetConnectionRetries(); - void ResetConnectionRetries(); -*/ -class RetrySocket : public TcpSocket -{ -public: - RetrySocket(ISocketHandler& h) : TcpSocket(h) { - SetConnectTimeout(2); - SetConnectionRetry(-1); - } - - bool OnConnectRetry() { - printf("Connection attempt#%d\n", GetConnectionRetries()); - if (GetConnectionRetries() == 3) - { - ListenSocket *l = new ListenSocket(Handler()); - if (l -> Bind(12345)) - { - printf("Bind port 12345 failed\n"); - } - l -> SetDeleteByHandler(); - Handler().Add(l); - } - return true; - } - - void OnConnect() { - printf("Connected\n"); - printf("GetRemoteAddress(): %s\n", GetRemoteAddress().c_str()); - printf("Remote address: %s\n", GetRemoteSocketAddress() -> Convert(false).c_str()); - printf("Remote address: %s\n", GetRemoteSocketAddress() -> Convert(true).c_str()); - SetCloseAndDelete(); - } - - void OnDelete() { - quit = true; - } -}; - - -int main(int argc, char *argv[]) -{ - SocketHandler h; - RetrySocket sock(h); - sock.Open("localhost", 12345); - h.Add(&sock); - while (!quit) - { - h.Select(0, 200000); - } -} - - -- cgit v1.2.3