mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 03:36:47 -04:00
Fix TCP socket finishConnect() exception handling and connection logic
- Fix bug where finishConnect() required multiple calls before throwing exceptions - Fix logic where address resolution didn't immediately attempt connection - After address is resolved, immediately call channel.finishConnect() - Ensures immediate error reporting for failed socket connections - Improves reliability of socket connection error handling
This commit is contained in:
parent
a43004760f
commit
6aa321971e
@ -329,7 +329,9 @@ object InternetCard {
|
||||
private def checkConnected() = {
|
||||
if (owner.isEmpty) throw new IOException("connection lost")
|
||||
try {
|
||||
if (isAddressResolved) channel.finishConnect()
|
||||
if (isAddressResolved) {
|
||||
channel.finishConnect()
|
||||
}
|
||||
else if (address.isCancelled) {
|
||||
// I don't think this can ever happen, Justin Case.
|
||||
channel.close()
|
||||
@ -341,14 +343,15 @@ object InternetCard {
|
||||
case e: ExecutionException => throw e.getCause
|
||||
}
|
||||
isAddressResolved = true
|
||||
false
|
||||
// After address resolution, immediately attempt connection
|
||||
channel.finishConnect()
|
||||
}
|
||||
else false
|
||||
}
|
||||
catch {
|
||||
case t: Throwable =>
|
||||
close()
|
||||
false
|
||||
throw t // Propagate exception instead of returning false
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user