File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,22 +119,32 @@ struct JackRequest
119119 virtual ~JackRequest ()
120120 {}
121121
122- virtual int Read (detail::JackChannelTransactionInterface* trans)
123- {
124- return trans->Read (&fType , sizeof (RequestType));
125- }
122+ virtual int Read (detail::JackChannelTransactionInterface* trans) = 0;
126123
127- virtual int Write (detail::JackChannelTransactionInterface* trans) { return - 1 ; }
124+ virtual int Write (detail::JackChannelTransactionInterface* trans) = 0;
128125
129- virtual int Write (detail::JackChannelTransactionInterface* trans, int size)
126+ virtual int Size () const = 0;
127+
128+ int Write (detail::JackChannelTransactionInterface* trans, int size)
130129 {
131130 fSize = size;
132131 CheckRes (trans->Write (&fType , sizeof (RequestType)));
133132 return trans->Write (&fSize , sizeof (int ));
134133 }
135134
136- virtual int Size () const { return 0 ; }
135+ };
136+
137+ struct JackRequestHeader
138+ {
139+ JackRequest::RequestType fType ;
140+
141+ JackRequestHeader (): fType ((JackRequest::RequestType)0 )
142+ {}
137143
144+ int Read (detail::JackChannelTransactionInterface* trans)
145+ {
146+ return trans->Read (&fType , sizeof (JackRequest::RequestType));
147+ }
138148};
139149
140150/* !
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ int JackRequestDecoder::HandleRequest(detail::JackChannelTransactionInterface* s
5858 CheckWriteName (" JackRequest::ClientCheck" , socket);
5959 // Atomic ClientCheck followed by ClientOpen on same socket
6060 if (req.fOpen ) {
61- JackRequest header;
61+ JackRequestHeader header;
6262 header.Read (socket);
6363 return HandleRequest (socket, header.fType );
6464 }
Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ bool JackSocketServerChannel::Execute()
235235 } else if (fPollTable [i].revents & POLLIN) {
236236 JackClientSocket* socket = fSocketTable [fd].second ;
237237 // Decode header
238- JackRequest header;
238+ JackRequestHeader header;
239239 if (header.Read (socket) < 0 ) {
240240 jack_log (" JackSocketServerChannel::Execute : cannot decode header" );
241241 ClientKill (fd);
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ bool JackClientPipeThread::Execute()
8383 try {
8484
8585 jack_log (" JackClientPipeThread::Execute %x" , this );
86- JackRequest header;
86+ JackRequestHeader header;
8787 int res = header.Read (fPipe );
8888 bool ret = true ;
8989
You can’t perform that action at this time.
0 commit comments