[QFJ-266] Initiator can't reconnect if there was no network during startup. Created: 22/Nov/07  Updated: 15/Jan/08  Resolved: 22/Dec/07

Status: Closed
Project: QuickFIX/J
Component/s: None
Affects Version/s: 1.2.1, 1.3.0
Fix Version/s: 1.3.1

Type: Bug Priority: Default
Reporter: Bartosz Lawniczek Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Environment:

Windows XP



 Description   

IoSessionInitiator.connect() method throws UnresolvedAddressException if there is no network connection. After connection is reestablished it is not able to recover and still throws UnresolvedAddressException.

This is because InetSocketAddress is created only ones during startup. If it was not resolved then it will never be resolved.

Workaround is to create new InetSocketAddress each time the Initiator tries to reconnect and the address is unresolved. Modification of IoSessionInitiator.getNextSocketAddress() that fixed the problem for me:

private SocketAddress getNextSocketAddress() {
SocketAddress socketAddress = socketAddresses[nextSocketAddressIndex];

if (socketAddress instanceof InetSocketAddress) {
InetSocketAddress inetAddr = (InetSocketAddress) socketAddress;
if (inetAddr.isUnresolved())

{ socketAddress = new InetSocketAddress(inetAddr.getHostName(), inetAddr.getPort()); socketAddresses[nextSocketAddressIndex] = socketAddress; }

}

nextSocketAddressIndex = (nextSocketAddressIndex + 1) % socketAddresses.length;
return socketAddress;
}



 Comments   
Comment by Steve Bate [ 22/Dec/07 ]

Added the patch. Thanks.

Generated at Sat Nov 23 11:20:28 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.