提交 06baccc9 authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #592 from dubrovskip/master

"Connection is broken: "unexpected status 16777216" [90067-192]" message when using older h2 releases as client
...@@ -82,18 +82,18 @@ public class TcpServerThread implements Runnable { ...@@ -82,18 +82,18 @@ public class TcpServerThread implements Runnable {
throw DbException.get(ErrorCode.REMOTE_CONNECTION_NOT_ALLOWED); throw DbException.get(ErrorCode.REMOTE_CONNECTION_NOT_ALLOWED);
} }
int minClientVersion = transfer.readInt(); int minClientVersion = transfer.readInt();
if (minClientVersion < Constants.TCP_PROTOCOL_VERSION_6) { int maxClientVersion = transfer.readInt();
if (maxClientVersion < Constants.TCP_PROTOCOL_VERSION_6) {
throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2, throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2,
"" + clientVersion, "" + Constants.TCP_PROTOCOL_VERSION_6); "" + clientVersion, "" + Constants.TCP_PROTOCOL_VERSION_6);
} else if (minClientVersion > Constants.TCP_PROTOCOL_VERSION_16) { } else if (minClientVersion > Constants.TCP_PROTOCOL_VERSION_16) {
throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2, throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2,
"" + clientVersion, "" + Constants.TCP_PROTOCOL_VERSION_16); "" + clientVersion, "" + Constants.TCP_PROTOCOL_VERSION_16);
} }
int maxClientVersion = transfer.readInt();
if (maxClientVersion >= Constants.TCP_PROTOCOL_VERSION_16) { if (maxClientVersion >= Constants.TCP_PROTOCOL_VERSION_16) {
clientVersion = Constants.TCP_PROTOCOL_VERSION_16; clientVersion = Constants.TCP_PROTOCOL_VERSION_16;
} else { } else {
clientVersion = minClientVersion; clientVersion = maxClientVersion;
} }
transfer.setVersion(clientVersion); transfer.setVersion(clientVersion);
String db = transfer.readString(); String db = transfer.readString();
...@@ -411,7 +411,9 @@ public class TcpServerThread implements Runnable { ...@@ -411,7 +411,9 @@ public class TcpServerThread implements Runnable {
case SessionRemote.SESSION_SET_ID: { case SessionRemote.SESSION_SET_ID: {
sessionId = transfer.readString(); sessionId = transfer.readString();
transfer.writeInt(SessionRemote.STATUS_OK); transfer.writeInt(SessionRemote.STATUS_OK);
if (clientVersion >= Constants.TCP_PROTOCOL_VERSION_15) {
transfer.writeBoolean(session.getAutoCommit()); transfer.writeBoolean(session.getAutoCommit());
}
transfer.flush(); transfer.flush();
break; break;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论