Changeset 32:fd970caf83eb in vscpl for src/hu/varadiistvan/scpl/io/_posix/LocalAcceptor.h
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 //------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.