@@ -42,10 +42,9 @@ class Message {
4242 this . functionCode = 0 ;
4343 this . callStatus = 0 ;
4444 this . flushOutBinds = false ;
45+ this . endOfResponse = false ;
4546 this . endToEndSeqNum = 0 ;
4647 this . errorOccurred = false ;
47- this . flushOutBinds = false ;
48- this . processedError = false ;
4948 this . warning = undefined ;
5049 }
5150
@@ -161,7 +160,7 @@ class Message {
161160 */
162161 this . errorInfo . message = this . errorInfo . message . trim ( ) ;
163162 }
164- this . processedError = true ;
163+ this . endOfResponse = ! this . connection . nscon . endOfRequestSupport ;
165164 }
166165
167166 processReturnParameter ( ) { }
@@ -178,22 +177,18 @@ class Message {
178177 }
179178 }
180179
181- hasMoreData ( buf ) {
182- return buf . numBytesLeft ( ) > 0 && ! this . flushOutBinds ;
183- }
184-
185180 decode ( buf ) {
186181 this . process ( buf ) ;
187182 }
188183
189184 process ( buf ) {
185+ this . endOfResponse = false ;
190186 this . flushOutBinds = false ;
191- this . processedError = false ;
192187 do {
193188 this . savePoint ( buf ) ;
194189 const messageType = buf . readUInt8 ( ) ;
195190 this . processMessage ( buf , messageType ) ;
196- } while ( this . hasMoreData ( buf ) ) ;
191+ } while ( ! this . endOfResponse ) ;
197192 }
198193
199194 savePoint ( buf ) {
@@ -208,10 +203,13 @@ class Message {
208203 } else if ( messageType === constants . TNS_MSG_TYPE_STATUS ) {
209204 this . callStatus = buf . readUB4 ( ) ;
210205 this . endToEndSeqNum = buf . readUB2 ( ) ;
206+ this . endOfResponse = ! this . connection . nscon . endOfRequestSupport ;
211207 } else if ( messageType === constants . TNS_MSG_TYPE_PARAMETER ) {
212208 this . processReturnParameter ( buf ) ;
213209 } else if ( messageType === constants . TNS_MSG_TYPE_SERVER_SIDE_PIGGYBACK ) {
214210 this . processServerSidePiggyBack ( buf ) ;
211+ } else if ( messageType === constants . TNS_MSG_TYPE_END_OF_REQUEST ) {
212+ this . endOfResponse = true ;
215213 } else {
216214 errors . throwErr ( errors . ERR_UNEXPECTED_MESSAGE_TYPE , messageType , buf . pos , buf . packetNum ) ;
217215 }
0 commit comments