socket timeout

4 views
Skip to first unread message

Alex Rass

unread,
Nov 7, 2008, 2:06:48 PM11/7/08
to joscar-...@googlegroups.com

Hi.

 

I am looking at adding a socket timeout:

 

      try

      {

          socket.setSoTimeout (TIMEOUT);

      }

      catch (SocketException se)

      {

        // we no care

      }

 

 

To net.kano.joustsim.oscar.oscar.service.icbm.ft.controllers.AbstractOutgoingConnectionController

 

At line 66.

Is this a bad idea?

Is there a better place?

 

What about the server sockets, do you think they need one too?

 

- Alex.

 

Keith Lea

unread,
Nov 7, 2008, 7:18:05 PM11/7/08
to joscar-...@googlegroups.com
Sounds OK to me. I don't know much about so_timeout.

Alex Rass

unread,
Nov 8, 2008, 12:24:40 PM11/8/08
to joscar-...@googlegroups.com

Anyone knows what these are?

Getting a ton of these lately:

Unknown TLV's in InfoData: [TLV: type=0xb, length=4, …

 Anything important?

Anyone wants to add these in?

 

 


Alex Rass

unread,
Nov 9, 2008, 11:57:02 PM11/9/08
to joscar-...@googlegroups.com

Ok,

Doing a little debugging.

I am now in a state where the network socket has clearly been dropped. Netstat shows nothing. I am told by others I am not online (just for sanity check).

 

I put a breakpoint in AbstractFlapProcessor

                block.write(out);

line 295.

 

Evaluating “out”, says that socket is happy, connected isn’t closing and life is otherwise fantastic.

 

Now would this be a bug with JDK?!

Cause this is insane.

 

Keith, is there something else I should look at?

Alex Rass

unread,
Nov 15, 2008, 1:37:43 PM11/15/08
to joscar-...@googlegroups.com

Does anyone have sample code of how to delete contacts?

Mine d/n seem to quite do the job.

Keith Lea

unread,
Nov 15, 2008, 2:56:15 PM11/15/08
to joscar-...@googlegroups.com
This is what I have found as well from debugging. I think it is JDK bug.

Keith Lea

unread,
Nov 15, 2008, 2:59:37 PM11/15/08
to joscar-...@googlegroups.com
Just check to see if the group is a DeleteMutableGroup (which I believe all groups except the synthetic catchall group are instances of this interface) and upcast.

Alex Rass

unread,
Nov 15, 2008, 4:57:28 PM11/15/08
to joscar-...@googlegroups.com

Maybe I am not getting the naming right, but why “group”?

I am trying to delete contacts, not groups.

And buddy manager (one that so nicely covers all buddy management) doesn’t have a delete method for a buddy, but only for a group…

What’s going on with naming here? Am I missing something and there’s an easier way through all this delete business?

 


From: joscar-...@googlegroups.com [mailto:joscar-...@googlegroups.com] On Behalf Of Keith Lea


Sent: Saturday, November 15, 2008 3:00 PM
To: joscar-...@googlegroups.com

Keith Lea

unread,
Nov 16, 2008, 3:42:21 PM11/16/08
to joscar-...@googlegroups.com
If you look at DeleteMutableGroup it has a deleteBuddy function. A DeleteMutableGroup is a group which is mutable and provides a delete function. As I said not all groups support this, because some groups are completely synthetic (I forget the details of why this was necessary).

Alex Rass

unread,
Nov 16, 2008, 5:11:58 PM11/16/08
to joscar-...@googlegroups.com

So, what’s the approach if I need to delete a buddy then? (say user clicks on a buddy in my list and says “Remove”).

 

Do I need to create some fake group, move that buddy to it and nuke the whole group?

Do I just expose the deleteBuddy function on DeleteMutableGroup? 

Some third choice that I missed?

This isn’t self-explanatory, sorry to ask you like 3 times now :)

Keith Lea

unread,
Nov 16, 2008, 5:27:10 PM11/16/08
to joscar-...@googlegroups.com
deleteBuddy deletes a buddy, not a group. Here's some pseudocode:

Group group = buddyToDelete.getGroup();
if (!(group instanceof DeleteMutableGroup)) {
  error("buddy cannot be deleted because it is not in a group");
  return;
}
DeleteMutableGroup dmg = (DeleteMutableGroup) group;
dmg.deleteBuddy(buddyToDelete);

Makes more sense now?

Alex Rass

unread,
Nov 17, 2008, 1:36:57 AM11/17/08
to joscar-...@googlegroups.com

Ok, new version is 5x shorter… and works. Who knew it was all already there! J

Thanks, man.

Alex Rass

unread,
Nov 17, 2008, 2:45:53 AM11/17/08
to joscar-...@googlegroups.com

If there are issues connecting, Oscar can get into a state where it d/n connect nor can I tell it to disconnect (and stop trying).

 

OscarConnection:256

    if (disconnected) return false;

 

disconnect is always true. So I can’t execute conn.disconnect() couple lines below.

 

Not sure if this is a good test.

But that’s not enough either, because even if I debug-set that to false, and run conn.disconnect(), I keept getting:

Nov 17, 2008 1:34:38 AM net.kano.joustsim.oscar.ExternalServiceManager$4 run

INFO: External service for arbiter net.kano.joustsim.oscar.oscar.service.chatrooms.RoomFinderServiceArbiter@4a117f(0xd) timed out after 15.0s; retrying

 

Nothing crazy. But I’ve seen this happen from time to time, and this time I was armed with a debugger.

Reply all
Reply to author
Forward
0 new messages