Really odd proxy bug. Fixed. (Yay!)

I sorted out a really interesting proxy bug, which means that my proxy code now apears to work correctly with WordPress posting.

What was really happening is this: in my test harness I’ve turned off the connection shutdown timer code, so the connection stays alive indefinitely. But on the WordPress side, as I was typing in a long post, it would shut its side of the connection down.

Now I have a call in my outbound connection code which was verifying the connection was open by calling the java.net.Socket calls ‘isClosed’, ‘isConnected’, ‘isInputShutdown’ and ‘isOutputShutdown’ routines to see if the connection was still open. If the connection had been closed, this was supposed to bring the connection down, discard the socket, and reconnect it fresh.

And apparently, even though all of these calls were indicating the connection was open, the moment I sent data out, I was getting an ‘end of connection’ error on reading the input stream from the socket.

So I kludged it: if I get an end of connection when I expect a response, close down the socket, re-open it, and try the connection again–but only once. If it fails a second time, bail.

This appears to do the trick–I managed to post this through the firewall code, where yesterday I was failing.

That means I can clean this up, post it to the ‘net (probably on Monday) and set up my proxy so I can get my e-mail from work… 🙂

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s