diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-01-10 21:04:17 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-01-10 21:04:17 +0000 |
commit | 2ba3f84ab559da02a11aa000b3cecb3b3668af61 (patch) | |
tree | 266f450b512f607ec54d54af4fa8c13fdbe7ef91 /src/tests | |
parent | ea18007633b31901f2ae275cc0576c3f7ce99fc9 (diff) | |
parent | 3611f253f6fdfa4954d374ab85ddaa7f799c130c (diff) | |
download | libbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.tar.gz libbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.tar.bz2 libbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.tar.xz libbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.zip |
Merged in the core branch. This is a major update that fixes many things, and
changes many others, including source files that were deleted and renamed.
Before doing this update, I reccomend a full clean, or even a fresh checkout.
Things to note, most outstanding about this update:
- Bu::Socket was changed to Bu::TcpSocket and the default mode is blocking.
- All templatized container classes are SharedCore now, which is good, but
SharedCore is inherently non-reentrant safe. However, all SharedCore classes
have a "clone" function that return a non-shared copy of the object, safe for
passing into a reentrant safe function accessing shared memory.
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/sharedcore.cpp | 2 | ||||
-rw-r--r-- | src/tests/socketblock.cpp | 10 | ||||
-rw-r--r-- | src/tests/socketbreak.cpp | 10 | ||||
-rw-r--r-- | src/tests/tcpsocket.cpp (renamed from src/tests/socket.cpp) | 4 |
4 files changed, 13 insertions, 13 deletions
diff --git a/src/tests/sharedcore.cpp b/src/tests/sharedcore.cpp index 1d0c16e..9b0a0ec 100644 --- a/src/tests/sharedcore.cpp +++ b/src/tests/sharedcore.cpp | |||
@@ -14,7 +14,7 @@ struct ShintCore | |||
14 | { | 14 | { |
15 | int val; | 15 | int val; |
16 | }; | 16 | }; |
17 | class Shint : public Bu::SharedCore<struct ShintCore> | 17 | class Shint : public Bu::SharedCore<Shint, struct ShintCore> |
18 | { | 18 | { |
19 | public: | 19 | public: |
20 | Shint() | 20 | Shint() |
diff --git a/src/tests/socketblock.cpp b/src/tests/socketblock.cpp index a1ea18d..793ef96 100644 --- a/src/tests/socketblock.cpp +++ b/src/tests/socketblock.cpp | |||
@@ -6,8 +6,8 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include "bu/ito.h" | 8 | #include "bu/ito.h" |
9 | #include "bu/socket.h" | 9 | #include "bu/tcpsocket.h" |
10 | #include "bu/serversocket.h" | 10 | #include "bu/tcpserversocket.h" |
11 | #include <stdio.h> | 11 | #include <stdio.h> |
12 | #include <unistd.h> | 12 | #include <unistd.h> |
13 | 13 | ||
@@ -21,7 +21,7 @@ public: | |||
21 | 21 | ||
22 | virtual void run() | 22 | virtual void run() |
23 | { | 23 | { |
24 | Bu::Socket c = s.accept( 45, 0 ); | 24 | Bu::TcpSocket c = s.accept( 45, 0 ); |
25 | printf("TstServer: Accetped connection.\n"); fflush( stdout ); | 25 | printf("TstServer: Accetped connection.\n"); fflush( stdout ); |
26 | 26 | ||
27 | sleep( 1 ); | 27 | sleep( 1 ); |
@@ -35,7 +35,7 @@ public: | |||
35 | c.close(); | 35 | c.close(); |
36 | } | 36 | } |
37 | 37 | ||
38 | Bu::ServerSocket s; | 38 | Bu::TcpServerSocket s; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | int main() | 41 | int main() |
@@ -45,7 +45,7 @@ int main() | |||
45 | ts.start(); | 45 | ts.start(); |
46 | 46 | ||
47 | printf("main: Connecting to server.\n"); fflush( stdout ); | 47 | printf("main: Connecting to server.\n"); fflush( stdout ); |
48 | Bu::Socket s( "localhost", 55678 ); | 48 | Bu::TcpSocket s( "localhost", 55678 ); |
49 | 49 | ||
50 | printf("main: Sending 4 bytes.\n"); fflush( stdout ); | 50 | printf("main: Sending 4 bytes.\n"); fflush( stdout ); |
51 | s.write( "aoeu", 4 ); | 51 | s.write( "aoeu", 4 ); |
diff --git a/src/tests/socketbreak.cpp b/src/tests/socketbreak.cpp index 8339630..7d3c71a 100644 --- a/src/tests/socketbreak.cpp +++ b/src/tests/socketbreak.cpp | |||
@@ -5,17 +5,17 @@ | |||
5 | * terms of the license contained in the file LICENSE. | 5 | * terms of the license contained in the file LICENSE. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include "bu/serversocket.h" | 8 | #include "bu/tcpserversocket.h" |
9 | #include "bu/socket.h" | 9 | #include "bu/tcpsocket.h" |
10 | #include <unistd.h> | 10 | #include <unistd.h> |
11 | 11 | ||
12 | int main() | 12 | int main() |
13 | { | 13 | { |
14 | Bu::ServerSocket sSrv( 9987 ); | 14 | Bu::TcpServerSocket sSrv( 9987 ); |
15 | 15 | ||
16 | Bu::Socket sSend("localhost", 9987 ); | 16 | Bu::TcpSocket sSend("localhost", 9987 ); |
17 | 17 | ||
18 | Bu::Socket sRecv( sSrv.accept() ); | 18 | Bu::TcpSocket sRecv( sSrv.accept() ); |
19 | 19 | ||
20 | printf("Connected sockets.\n"); | 20 | printf("Connected sockets.\n"); |
21 | 21 | ||
diff --git a/src/tests/socket.cpp b/src/tests/tcpsocket.cpp index ba4e9b9..30dd22f 100644 --- a/src/tests/socket.cpp +++ b/src/tests/tcpsocket.cpp | |||
@@ -5,7 +5,7 @@ | |||
5 | * terms of the license contained in the file LICENSE. | 5 | * terms of the license contained in the file LICENSE. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <bu/socket.h> | 8 | #include <bu/tcpsocket.h> |
9 | #include <bu/sio.h> | 9 | #include <bu/sio.h> |
10 | 10 | ||
11 | #include <sys/time.h> | 11 | #include <sys/time.h> |
@@ -17,7 +17,7 @@ bool isUp() | |||
17 | { | 17 | { |
18 | try | 18 | try |
19 | { | 19 | { |
20 | Socket s("xagasoft.com", 9898, 1 ); | 20 | TcpSocket s("xagasoft.com", 9898, 1 ); |
21 | 21 | ||
22 | char buf[5]; | 22 | char buf[5]; |
23 | buf[s.read(buf, 2, 1, 0)] = '\0'; | 23 | buf[s.read(buf, 2, 1, 0)] = '\0'; |