Changeset 13:af2a928f0e63 in xplcommon


Ignore:
Timestamp:
12/29/12 09:23:04 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 2 'hg:/home/ivaradi/xplane/hg/xplcommon' '/'>, 'public')
Message:

Added the deleting of the socket file when the socket object is destroyed

Location:
src/xplcommon/posix
Files:
2 edited

Legend:

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

    r12 r13  
    3939
    4040#include <sys/socket.h>
    41 #include <sys/un.h>
    4241
    4342//------------------------------------------------------------------------------
     
    6463    acceptor(this)
    6564{
    66     struct sockaddr_un sun;
    6765    sun.sun_family = AF_UNIX;
    6866    setupPath(sun, name);
     
    8381//------------------------------------------------------------------------------
    8482
     83LocalServerSocket::~LocalServerSocket()
     84{
     85    unlink(sun.sun_path);
     86}
     87
     88//------------------------------------------------------------------------------
     89
    8590// Local Variables:
    8691// mode: C++
  • src/xplcommon/posix/LocalServerSocket.h

    r11 r13  
    3737#include "LocalAcceptor.h"
    3838
    39 //------------------------------------------------------------------------------
    40 
    41 struct sockaddr_un;
     39#include <sys/un.h>
    4240
    4341//------------------------------------------------------------------------------
     
    6260
    6361    /**
     62     * Our address (to be used when deleting the file in the
     63     * destructor.
     64     */
     65    struct sockaddr_un sun;
     66
     67    /**
    6468     * The acceptor to use for accepting connections.
    6569     */
     
    7983     */
    8084    LocalServerSocket(const char* name, Waiter* waiter = 0);
     85
     86    /**
     87     * Destroy the socket by deleting the file.
     88     */
     89    virtual ~LocalServerSocket();
    8190
    8291    /**
Note: See TracChangeset for help on using the changeset viewer.