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/tcpsocket.h | |
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 '')
-rw-r--r-- | src/tcpsocket.h (renamed from src/socket.h) | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/socket.h b/src/tcpsocket.h index c8f78f0..3361e84 100644 --- a/src/socket.h +++ b/src/tcpsocket.h | |||
@@ -5,8 +5,8 @@ | |||
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 | #ifndef BU_SOCKET_H | 8 | #ifndef BU_TCP_SOCKET_H |
9 | #define BU_SOCKET_H | 9 | #define BU_TCP_SOCKET_H |
10 | 10 | ||
11 | #include <stdint.h> | 11 | #include <stdint.h> |
12 | 12 | ||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | namespace Bu | 17 | namespace Bu |
18 | { | 18 | { |
19 | subExceptionDeclBegin( SocketException ); | 19 | subExceptionDeclBegin( TcpSocketException ); |
20 | enum { | 20 | enum { |
21 | cRead, | 21 | cRead, |
22 | cWrite, | 22 | cWrite, |
@@ -40,28 +40,29 @@ namespace Bu | |||
40 | * Please note that there is a condition that will occur eventually (at | 40 | * Please note that there is a condition that will occur eventually (at |
41 | * least on *nix systems) that will trigger a SIGPIPE condition. This | 41 | * least on *nix systems) that will trigger a SIGPIPE condition. This |
42 | * will terminate your program immediately unless handled properly. Most | 42 | * will terminate your program immediately unless handled properly. Most |
43 | * people doing any connections with Socket will want to put this in their | 43 | * people doing any connections with TcpSocket will want to put this in |
44 | * program somewhere before they use it: | 44 | * their program somewhere before they use it: |
45 | *@code | 45 | *@code |
46 | #include <signal.h> | 46 | #include <signal.h> |
47 | ... | 47 | ... |
48 | ... | 48 | ... |
49 | ... | 49 | ... |
50 | sigset( SIGPIPE, SIG_IGN ); // do this before you use a Bu::Socket | 50 | sigset( SIGPIPE, SIG_IGN ); // do this before you use a Bu::TcpSocket |
51 | @endcode | 51 | @endcode |
52 | * When this is done, Bu::Socket will simply throw a broken pipe exception | 52 | * When this is done, Bu::TcpSocket will simply throw a broken pipe |
53 | * just like every other error condition, allowing your program to handle | 53 | * exception just like every other error condition, allowing your program |
54 | * it sanely. | 54 | * to handle it sanely. |
55 | * | 55 | * |
56 | *@ingroup Serving | 56 | *@ingroup Serving |
57 | *@ingroup Streams | 57 | *@ingroup Streams |
58 | */ | 58 | */ |
59 | class Socket : public Stream | 59 | class TcpSocket : public Stream |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | Socket( int nSocket ); | 62 | TcpSocket( int nTcpSocket ); |
63 | Socket( const FString &sAddr, int nPort, int nTimeout=30 ); | 63 | TcpSocket( const FString &sAddr, int nPort, int nTimeout=30, |
64 | virtual ~Socket(); | 64 | bool bBlocking=true ); |
65 | virtual ~TcpSocket(); | ||
65 | 66 | ||
66 | virtual void close(); | 67 | virtual void close(); |
67 | //virtual void read(); | 68 | //virtual void read(); |
@@ -101,9 +102,9 @@ namespace Bu | |||
101 | void setAddress(); | 102 | void setAddress(); |
102 | 103 | ||
103 | #ifdef WIN32 | 104 | #ifdef WIN32 |
104 | unsigned int nSocket; | 105 | unsigned int nTcpSocket; |
105 | #else | 106 | #else |
106 | int nSocket; | 107 | int nTcpSocket; |
107 | #endif | 108 | #endif |
108 | bool bActive; | 109 | bool bActive; |
109 | bool bBlocking; | 110 | bool bBlocking; |