Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisnas committed Apr 12, 2024
1 parent eb6bf7b commit 4d8ddfb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,39 +207,6 @@ void CALLBACK IpcServer::StartCallback(PTP_CALLBACK_INSTANCE instance, PVOID con
::DisconnectNamedPipe(pThis->_hNamedPipe);
::CloseHandle(pThis->_hNamedPipe);
pThis->_hNamedPipe = nullptr;

//auto pServerInfo = new ServerInfo();
//pServerInfo->pThis = pThis;
//pServerInfo->hPipe = pThis->_hNamedPipe;

//// TODO: we don't really need to use a threadpool thread because we are already in a threadpool thread
//if (!::TrySubmitThreadpoolCallback(ConnectCallback, pServerInfo, nullptr))
//{
// delete pServerInfo;

// pThis->ShowLastError("Impossible to add the Connect callback into the threadpool...");
// pThis->_pHandler->OnStartError();

// ::CloseHandle(pThis->_hNamedPipe);
// pThis->_hNamedPipe = nullptr;

// return;
//}
}

void CALLBACK IpcServer::ConnectCallback(PTP_CALLBACK_INSTANCE instance, PVOID context)
{
ServerInfo* pInfo = reinterpret_cast<ServerInfo*>(context);
IpcServer* pThis = pInfo->pThis;
HANDLE hPipe = pInfo->hPipe;
delete pInfo;

// this is a blocking call until the communication ends on this named pipe
pThis->_pHandler->OnConnect(hPipe);

// cleanup
::DisconnectNamedPipe(hPipe);
::CloseHandle(hPipe);
}

void IpcServer::ShowLastError(const char* message, uint32_t lastError)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ class IpcServer

private:
static void CALLBACK StartCallback(PTP_CALLBACK_INSTANCE instance, PVOID context);
static void CALLBACK StartCallbackEx(PTP_CALLBACK_INSTANCE instance, PVOID context);
static void CALLBACK ConnectCallback(PTP_CALLBACK_INSTANCE instance, PVOID context);
void ShowLastError(const char* message, uint32_t lastError = ::GetLastError());

private:
Expand Down

0 comments on commit 4d8ddfb

Please sign in to comment.