~ubuntu-branches/ubuntu/lucid/codelite/lucid

« back to all changes in this revision

Viewing changes to sdk/codelite_indexer/network/named_pipe_server.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2009-02-10 02:27:55 UTC
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20090210022755-mxlvij3ndab1n5ty
Tags: upstream-1.0.2759+dfsg
ImportĀ upstreamĀ versionĀ 1.0.2759+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "named_pipe_server.h"
 
2
#ifndef __WXMSW__
 
3
# include <sys/types.h>
 
4
# include <sys/unistd.h>
 
5
# include <sys/socket.h>
 
6
#endif
 
7
clNamedPipeServer::clNamedPipeServer(const char* pipePath)
 
8
                : clNamedPipe(pipePath)
 
9
{
 
10
 
 
11
}
 
12
 
 
13
 
 
14
clNamedPipeServer::~clNamedPipeServer(void)
 
15
{
 
16
        disconnect();
 
17
}
 
18
 
 
19
void clNamedPipeServer::disconnect()
 
20
{
 
21
        this->setLastError(ZNP_OK);
 
22
#ifdef __WXMSW__
 
23
        if (_pipeHandle != INVALID_PIPE_HANDLE) {
 
24
                FlushFileBuffers(_pipeHandle);
 
25
                DisconnectNamedPipe(_pipeHandle);
 
26
                CloseHandle(_pipeHandle);
 
27
                _pipeHandle = INVALID_PIPE_HANDLE;
 
28
        }
 
29
#else
 
30
        if( _pipeHandle != INVALID_PIPE_HANDLE ) {
 
31
                close(_pipeHandle);
 
32
                shutdown(_pipeHandle, SHUT_RDWR);
 
33
                _pipeHandle = INVALID_PIPE_HANDLE;
 
34
        }
 
35
#endif
 
36
}