Skip to content

Add getRequestSocket() SPI method and add impl to impls #31246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: integration
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.nio.ReadOnlyBufferException;
import java.util.Map;
import java.util.concurrent.locks.Lock;
Expand Down Expand Up @@ -1368,4 +1369,12 @@ protected void setAlpnNegotiator(ThirdPartyAlpnNegotiator negotiator) {
protected ThirdPartyAlpnNegotiator getAlpnNegotiator() {
return this.alpnNegotiator;
}

/**
* @return
*/
public Socket getSocket() {
// TODO Auto-generated method stub
return deviceServiceContext.getReadInterface().getSocket();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
Expand All @@ -13,6 +13,7 @@
package com.ibm.ws.channel.ssl.internal;

import java.io.IOException;
import java.net.Socket;

import javax.net.ssl.SSLEngineResult;
import javax.net.ssl.SSLEngineResult.HandshakeStatus;
Expand Down Expand Up @@ -1995,4 +1996,10 @@ public void run() {
}
}
}

@Override
public Socket getSocket() {
// TODO - is this correct?
return deviceReadContext.getSocket();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
Expand All @@ -13,6 +13,7 @@
package com.ibm.ws.channel.ssl.internal;

import java.io.IOException;
import java.net.Socket;
import java.nio.ReadOnlyBufferException;

import javax.net.ssl.SSLEngine;
Expand Down Expand Up @@ -1006,4 +1007,11 @@ public void run() {
}
}
}

@Override
public Socket getSocket() {
// TODO Auto-generated method stub
throw new IllegalStateException("getSocket() not implemented for class: " + this.getClass().getCanonicalName());

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
Expand All @@ -13,6 +13,7 @@
package com.ibm.ws.tcpchannel.internal;

import java.io.IOException;
import java.net.Socket;
import java.nio.ByteBuffer;
import java.util.LinkedList;
import java.util.List;
Expand Down Expand Up @@ -61,7 +62,7 @@ public class TCPBaseRequestContext implements TCPRequestContext, FFDCSelfIntrosp
protected TCPChannelConfiguration config;
protected long timeoutTime;
private int timeoutInterval;
private WsByteBuffer[] defaultBuffers = new WsByteBuffer[1];
private final WsByteBuffer[] defaultBuffers = new WsByteBuffer[1];
private ByteBuffer byteBufferArray[] = null;
private ByteBuffer byteBufferArrayDirect[] = null;
private boolean missedSet = false;
Expand All @@ -80,7 +81,7 @@ public class TCPBaseRequestContext implements TCPRequestContext, FFDCSelfIntrosp

/**
* Constructor.
*
*
* @param link
*/
protected TCPBaseRequestContext(TCPConnLink link) {
Expand All @@ -100,7 +101,7 @@ protected void abort() {

/**
* Check whether this context has been aborted previously or not.
*
*
* @return boolean
*/
protected boolean isAborted() {
Expand All @@ -109,7 +110,7 @@ protected boolean isAborted() {

/**
* Access the connection link for this context object.
*
*
* @return TCPConnLink
*/
public TCPConnLink getTCPConnLink() {
Expand All @@ -123,6 +124,7 @@ protected TCPChannelConfiguration getConfig() {
/**
* @see TCPRequestContext#getInterface()
*/
@Override
public TCPConnectionContext getInterface() {
return this.oTCPConnLink;
}
Expand All @@ -132,11 +134,13 @@ public TCPConnectionContext getInterface() {
/* =================================================================== */

/** @see TCPRequestContext#getBuffers() */
@Override
public WsByteBuffer[] getBuffers() {
return this.buffers;
}

/** @see TCPRequestContext#setBuffers(WsByteBuffer[]) */
@Override
public void setBuffers(WsByteBuffer[] bufs) {
this.missedSet = false;
this.buffers = bufs;
Expand Down Expand Up @@ -278,6 +282,7 @@ protected void setBuffersToDirect(WsByteBuffer[] bufs) {
/**
* @return WsByteBuffer
*/
@Override
public WsByteBuffer getBuffer() {
if (this.buffers == null) {
return null;
Expand All @@ -288,6 +293,7 @@ public WsByteBuffer getBuffer() {
/**
* @param buf
*/
@Override
public void setBuffer(WsByteBuffer buf) {

this.missedSet = false;
Expand Down Expand Up @@ -333,6 +339,7 @@ public void setBuffer(WsByteBuffer buf) {
/**
* Clear any buffers that are currently stored.
*/
@Override
public void clearBuffers() {
if (null != this.buffers) {
for (int i = 0; i < this.buffers.length; i++) {
Expand Down Expand Up @@ -392,7 +399,7 @@ protected long getIOCompleteAmount() {
* comparable format to System.currentTimeMillis) when this request
* will time out. Should only be invoked if the 'hasTimeout' method
* returns true for this request.
*
*
* @return long Point in time when request will timeout.
*/
public long getTimeoutTime() {
Expand All @@ -401,7 +408,7 @@ public long getTimeoutTime() {

/**
* Sets the timeout value returned by 'getTimeoutTime'.
*
*
* @param time
*/
protected void setTimeoutTime(int time) {
Expand All @@ -425,7 +432,7 @@ protected void setTimeoutTime(int time) {

/**
* Returns true if this request has an associated timeout.
*
*
* @return boolean
*/
protected boolean hasTimeout() {
Expand All @@ -434,7 +441,7 @@ protected boolean hasTimeout() {

/**
* Returns timoutInterval of this request.
*
*
* @return int
*/
public int getTimeoutInterval() {
Expand All @@ -443,7 +450,7 @@ public int getTimeoutInterval() {

/**
* Introspect this object for FFDC output.
*
*
* @return List<String>
*/
public List<String> introspect() {
Expand All @@ -468,6 +475,7 @@ public List<String> introspect() {
/*
* @see com.ibm.ws.ffdc.FFDCSelfIntrospectable#introspectSelf()
*/
@Override
public String[] introspectSelf() {
List<String> rc = introspect();
return rc.toArray(new String[rc.size()]);
Expand Down Expand Up @@ -513,11 +521,11 @@ protected ByteBuffer[] getByteBufferArrayDirect() {

/**
* Updates the IO byte counters, checks if IO operation is complete
*
*
* @param byteCount
* number of IO bytes for latest read/write
* number of IO bytes for latest read/write
* @param type
* 0 for read. 1 for write
* 0 for read. 1 for write
* @return true if IO operation has read/wrote enough bytes, false if not
*/
// IMPROVEMENT: this shouldn't be public, but needs to be for now.
Expand Down Expand Up @@ -564,4 +572,10 @@ public boolean updateIOCounts(long byteCount, int type) {
return rc;
}

@Override
public Socket getSocket() {
TCPConnLink connLink = getTCPConnLink();
return connLink.getSocket();
}

}
Loading