Changeset 18:0490048f256d in xplcommon


Ignore:
Timestamp:
12/29/12 11:05:33 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Implemented basic test program for the sockets

Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/xplcommon/posix/LocalServerSocket.cc

    r14 r18  
    3636#include <pwd.h>
    3737#include <unistd.h>
     38#include <poll.h>
    3839
    3940#include <sys/socket.h>
     
    8788//------------------------------------------------------------------------------
    8889
     90bool LocalServerSocket::isReady()
     91{
     92    return false;
     93}
     94
     95//------------------------------------------------------------------------------
     96
     97void LocalServerSocket::handleEvents(short events)
     98{
     99    if ((events&POLLIN)==POLLIN) {
     100        acceptor.accept();
     101    }
     102}
     103
     104//------------------------------------------------------------------------------
     105
    89106// Local Variables:
    90107// mode: C++
  • src/xplcommon/posix/LocalServerSocket.h

    r15 r18  
    9494    LocalAcceptor& getAcceptor();
    9595
     96protected:
     97    /**
     98     * Indicate if the waitable is ready, i.e. there is no need to
     99     * wait for it.
     100     */
     101    virtual bool isReady();
     102
     103    /**
     104     * Handle the given events.
     105     */
     106    virtual void handleEvents(short events);
     107
    96108    friend class LocalAcceptor;
    97109};
  • test/Makefile.am

    r4 r18  
    11INCLUDES=-I$(top_srcdir)/src
    22
    3 noinst_PROGRAMS=testevent
     3noinst_PROGRAMS=testevent testlocsock
    44
    55testevent_SOURCES=testevent.cc
    66testevent_LDADD=../src/xplcommon/libxplcommon.la -lpthread
     7
     8testlocsock_SOURCES=testlocsock.cc
     9testlocsock_LDADD=../src/xplcommon/libxplcommon.la -lpthread
Note: See TracChangeset for help on using the changeset viewer.