logger.warn("This proxy server is unavailable.state:" + state + "+host:" + address);
throw new Exception("This proxy server is unavailable.state:" + state + "+host:" + address);
}
increaseCU();
CSocket socket = null;
try {
try {
socket = this.scoketpool.getSocket();
byte[] data = p.toBytes(socket.isRights(),socket.getDESKey());
socket.registerRec(p.getSessionID());
socket.send(data);
} catch (Throwable ex) {
logger.error("Server get socket Exception", ex);
throw ex;
}finally {
if(socket != null){
socket.dispose();
}
}
byte[] buffer = socket.receive(p.getSessionID(), currUserCount);
Protocol result = Protocol.fromBytes(buffer,socket.isRights(),socket.getDESKey());
if (this.state == ServerState.Testing) {
relive();
}
return result;
} catch (IOException ex) {
logger.error("io exception", ex);
if (socket == null || !socket.connecting()) {
if (!test()) {
markAsDead();
}
}
throw ex;
} catch (Throwable ex) {
logger.error("request other Exception", ex);
throw ex;
} finally {
if (state == state.Testing) {
markAsDead();
}
if (socket != null) {
socket.unregisterRec(p.getSessionID());
}
decreaseCU();
}
}