(SocketWrapperBase<?> socket)
| 332 | |
| 333 | |
| 334 | @Override |
| 335 | public SocketState service(SocketWrapperBase<?> socket) throws IOException { |
| 336 | |
| 337 | RequestInfo rp = request.getRequestProcessor(); |
| 338 | rp.setStage(org.apache.coyote.Constants.STAGE_PARSE); |
| 339 | |
| 340 | // Setting up the socket |
| 341 | this.socketWrapper = socket; |
| 342 | |
| 343 | boolean cping = false; |
| 344 | // Expected to block on the first read as there should be at least one |
| 345 | // AJP message to read. |
| 346 | boolean firstRead = true; |
| 347 | |
| 348 | while (!getErrorState().isError() && !protocol.isPaused()) { |
| 349 | // Parsing the request header |
| 350 | try { |
| 351 | // Get first message of the request |
| 352 | if (!readMessage(requestHeaderMessage, firstRead)) { |
| 353 | break; |
| 354 | } |
| 355 | firstRead = false; |
| 356 | |
| 357 | // Processing the request so make sure the connection rather |
| 358 | // than keep-alive timeout is used |
| 359 | socketWrapper.setReadTimeout(protocol.getConnectionTimeout()); |
| 360 | |
| 361 | // Check message type, process right away and break if |
| 362 | // not regular request processing |
| 363 | int type = requestHeaderMessage.getByte(); |
| 364 | if (type == Constants.JK_AJP13_CPING_REQUEST) { |
| 365 | if (protocol.isPaused()) { |
| 366 | recycle(); |
| 367 | break; |
| 368 | } |
| 369 | cping = true; |
| 370 | try { |
| 371 | socketWrapper.write(true, pongMessageArray, 0, pongMessageArray.length); |
| 372 | socketWrapper.flush(true); |
| 373 | } catch (IOException ioe) { |
| 374 | if (getLog().isDebugEnabled()) { |
| 375 | getLog().debug(sm.getString("ajpprocessor.pongFail"), ioe); |
| 376 | } |
| 377 | setErrorState(ErrorState.CLOSE_CONNECTION_NOW, ioe); |
| 378 | } |
| 379 | recycle(); |
| 380 | continue; |
| 381 | } else if (type != Constants.JK_AJP13_FORWARD_REQUEST) { |
| 382 | // Unexpected packet type. Unread body packets should have |
| 383 | // been swallowed in finish(). |
| 384 | if (getLog().isDebugEnabled()) { |
| 385 | getLog().debug(sm.getString("ajpprocessor.unexpectedMessage", Integer.toString(type))); |
| 386 | } |
| 387 | setErrorState(ErrorState.CLOSE_CONNECTION_NOW, null); |
| 388 | break; |
| 389 | } |
| 390 | request.markStartTime(); |
| 391 | } catch (IOException ioe) { |
nothing calls this directly
no test coverage detected