Browse Source

Make JackRequest methods pure virtual

Signed-off-by: falkTX <falktx@falktx.com>
develop
falkTX 1 month ago
parent
commit
9cc1877b17
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 20 additions and 10 deletions
  1. +17
    -7
      common/JackRequest.h
  2. +1
    -1
      common/JackRequestDecoder.cpp
  3. +1
    -1
      posix/JackSocketServerChannel.cpp
  4. +1
    -1
      windows/JackWinNamedPipeServerChannel.cpp

+ 17
- 7
common/JackRequest.h View File

@@ -119,22 +119,32 @@ struct JackRequest
virtual ~JackRequest()
{}

virtual int Read(detail::JackChannelTransactionInterface* trans)
{
return trans->Read(&fType, sizeof(RequestType));
}
virtual int Read(detail::JackChannelTransactionInterface* trans) = 0;

virtual int Write(detail::JackChannelTransactionInterface* trans) { return -1; }
virtual int Write(detail::JackChannelTransactionInterface* trans) = 0;

virtual int Write(detail::JackChannelTransactionInterface* trans, int size)
virtual int Size() const = 0;

int Write(detail::JackChannelTransactionInterface* trans, int size)
{
fSize = size;
CheckRes(trans->Write(&fType, sizeof(RequestType)));
return trans->Write(&fSize, sizeof(int));
}

virtual int Size() const { return 0; }
};

struct JackRequestHeader
{
JackRequest::RequestType fType;

JackRequestHeader(): fType((JackRequest::RequestType)0)
{}

int Read(detail::JackChannelTransactionInterface* trans)
{
return trans->Read(&fType, sizeof(JackRequest::RequestType));
}
};

/*!


+ 1
- 1
common/JackRequestDecoder.cpp View File

@@ -58,7 +58,7 @@ int JackRequestDecoder::HandleRequest(detail::JackChannelTransactionInterface* s
CheckWriteName("JackRequest::ClientCheck", socket);
// Atomic ClientCheck followed by ClientOpen on same socket
if (req.fOpen) {
JackRequest header;
JackRequestHeader header;
header.Read(socket);
return HandleRequest(socket, header.fType);
}


+ 1
- 1
posix/JackSocketServerChannel.cpp View File

@@ -235,7 +235,7 @@ bool JackSocketServerChannel::Execute()
} else if (fPollTable[i].revents & POLLIN) {
JackClientSocket* socket = fSocketTable[fd].second;
// Decode header
JackRequest header;
JackRequestHeader header;
if (header.Read(socket) < 0) {
jack_log("JackSocketServerChannel::Execute : cannot decode header");
ClientKill(fd);


+ 1
- 1
windows/JackWinNamedPipeServerChannel.cpp View File

@@ -83,7 +83,7 @@ bool JackClientPipeThread::Execute()
try {

jack_log("JackClientPipeThread::Execute %x", this);
JackRequest header;
JackRequestHeader header;
int res = header.Read(fPipe);
bool ret = true;



Loading…
Cancel
Save