Changeset 32:fd970caf83eb in vscpl for src/hu/varadiistvan/scpl
- Timestamp:
- 12/15/22 18:11:45 (23 months ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/hu/varadiistvan/scpl/io/_posix
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/hu/varadiistvan/scpl/io/_posix/LocalAcceptor.h
r8 r32 31 31 //------------------------------------------------------------------------------ 32 32 33 #include " Acceptor.h"33 #include "SocketAcceptor.h" 34 34 35 35 #include "LocalSocket.h" … … 42 42 43 43 /** 44 * An acceptor that provides a LocalSocket for each accepted 45 * connection. 44 * An acceptor that provides a LocalSocket for each accepted connection 46 45 */ 47 class LocalAcceptor : public Acceptor46 class LocalAcceptor : public SocketAcceptor<LocalSocket> 48 47 { 49 48 private: 50 /** 51 * Construct the acceptor. 52 * 53 * @param addressLength the length of the buffer for the peer 54 * address. If 0, not buffer will be created. 55 */ 56 LocalAcceptor(ServerSocket* socket); 57 58 public: 59 /** 60 * Get the local socket accepted last. If no socket was accepted, 61 * return 0. The local socket's waiter will be the given one 62 * (which can be 0). 63 */ 64 LocalSocket* getSocket(Waiter* waiter, 65 size_t readingCapacity = LocalSocket::DEFAULT_CAPACITY, 66 size_t writingCapacity = LocalSocket::DEFAULT_CAPACITY); 67 /** 68 * Get the local socket accepted last. If no socket was accepted, 69 * return 0. The local socket's waiter will be the same as that of 70 * the associated server socket. 71 */ 72 LocalSocket* getSocket(size_t readingCapacity = LocalSocket::DEFAULT_CAPACITY, 73 size_t writingCapacity = LocalSocket::DEFAULT_CAPACITY); 74 49 using SocketAcceptor<LocalSocket>::SocketAcceptor; 75 50 76 51 friend class LocalServerSocket; 77 52 }; 78 79 //------------------------------------------------------------------------------80 // Inline definitions81 //------------------------------------------------------------------------------82 83 inline LocalAcceptor::LocalAcceptor(ServerSocket* socket) :84 Acceptor(socket)85 {86 }87 88 //------------------------------------------------------------------------------89 90 inline LocalSocket* LocalAcceptor::getSocket(Waiter* waiter,91 size_t readingCapacity,92 size_t writingCapacity)93 {94 if (acceptedFD<0) return 0;95 96 LocalSocket* socket = new LocalSocket(acceptedFD, waiter,97 readingCapacity, writingCapacity);98 connectionProcessed();99 return socket;100 }101 102 //------------------------------------------------------------------------------103 104 inline LocalSocket* LocalAcceptor::getSocket(size_t readingCapacity,105 size_t writingCapacity)106 {107 return getSocket(socket.getWaiter(), readingCapacity, writingCapacity);108 }109 53 110 54 //------------------------------------------------------------------------------ -
src/hu/varadiistvan/scpl/io/_posix/LocalSocket.h
r8 r32 52 52 size_t writingCapacity = DEFAULT_CAPACITY); 53 53 54 friend class LocalAcceptor;54 friend class SocketAcceptor<LocalSocket>; 55 55 }; 56 56 -
src/hu/varadiistvan/scpl/io/_posix/Makefile.am
r25 r32 18 18 LocalClientSocket.cc \ 19 19 Acceptor.cc \ 20 SocketAcceptor.h \ 20 21 ServerSocket.cc \ 21 22 LocalServerSocket.cc … … 36 37 LocalClientSocket.h \ 37 38 Acceptor.h \ 39 SocketAcceptor.h \ 38 40 ServerSocket.h \ 39 41 LocalSocket.h \
Note:
See TracChangeset
for help on using the changeset viewer.