Skip to content

Commit

Permalink
ssl supplyment:fix checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
dcy10000 committed Dec 6, 2024
1 parent ddba7b4 commit e821ef3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -860,10 +860,10 @@ public void handleSSLData(ByteBuffer dataBuffer) throws IOException {
return;
}
int offset = 0;
SSLProtoHandler proto = new SSLProtoHandler(this);
SSLProtoHandler sslProtoHandler = new SSLProtoHandler(this);
boolean hasRemaining = true;
while (hasRemaining) {
ProtoHandlerResult result = proto.handle(dataBuffer, offset, false, true);
ProtoHandlerResult result = sslProtoHandler.handle(dataBuffer, offset, false, true);
switch (result.getCode()) {
case SSL_PROTO_PACKET:
case SSL_CLOSE_PACKET:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.actiontech.dble.backend.pool.PooledConnectionListener;
import com.actiontech.dble.backend.pool.ReadTimeStatusInstance;
import com.actiontech.dble.buffer.BufferType;
import com.actiontech.dble.config.model.SystemConfig;
import com.actiontech.dble.config.model.db.DbInstanceConfig;
import com.actiontech.dble.net.IOProcessor;
import com.actiontech.dble.net.SocketWR;
Expand Down
15 changes: 7 additions & 8 deletions src/main/java/com/actiontech/dble/net/connection/SSLHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public void sendhandShake() throws SSLException {
default:
throw new IllegalStateException("unknown handshake status: " + handshakeStatus);
}

} catch (SSLException e) {
LOGGER.warn("during the handshake, unwrap data exception: ", e);
con.close("during the handshake, unwrap data fail");
Expand All @@ -90,14 +89,14 @@ private void unwrapNonAppData(byte[] data) {

try {

final SSLEngineResult result = unwrap(engine, in);
final Status status = result.getStatus();
final SSLEngineResult result = unwrap(engine, in);
final Status status = result.getStatus();

final int produced = result.bytesProduced();
final int consumed = result.bytesConsumed();
if (status == Status.CLOSED) {
return;
}
final int produced = result.bytesProduced();
final int consumed = result.bytesConsumed();
if (status == Status.CLOSED) {
return;
}
for (; ; ) {
final SSLEngineResult.HandshakeStatus handshakeStatus = engine.getHandshakeStatus();
switch (handshakeStatus) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* Create Date: 2024-12-05
*/
public interface IOpenSSLWrapper {
public SSLEngine createClientSSLEngine();
SSLEngine createClientSSLEngine();

public boolean initContext();
boolean initContext();

public SSLEngine createServerSSLEngine(boolean isAuthClient);
SSLEngine createServerSSLEngine(boolean isAuthClient);
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ private void handleHandshake(byte[] data) {
String serverPlugin = new String(handshakePacket.getAuthPluginName());
try {
pluginName = PluginName.valueOf(serverPlugin);
if (connection.isSupportSSL()) {//todo:move config in dbinstance scope
if (connection.isSupportSSL()) {
//todo:move config in dbinstance scope
sendSSLRequestPacket(++data[3]);
connection.sendSSLHandShake(OpenSSLWrapper.PROTOCOL);
} else {
Expand Down

0 comments on commit e821ef3

Please sign in to comment.