Skip navigation
6123 Views 4 Replies Latest reply: Apr 1, 2008 11:13 AM by richardl RSS
Bronze 3 posts since
Mar 28, 2008
Currently Being Moderated

Mar 30, 2008 5:20 PM

Calling session.logout causes IOException

 

I made the following changes to InputThread.java because on trying to call logout I kept getting exceptions. The exception was IOException rather than SocketException so I wonder if using diablo-jdk1.5.0 on FreeBSD  6.1-RELEASE might have some issues interpreting connection issues?

 

 

Seemed calling logout should not exception so I wonder what y'all think about this change.

 

 

   

 

 

--- src/main/java/org/openymsg/network/InputThread.java (revision 10146)

+++ src/main/java/org/openymsg/network/InputThread.java (working copy)

@@ -69,10 +69,11 @@

                        try {

                                process(parentSession.network.receivePacket());

                        } catch (UnknowServiceException e) {

-                               log.warn("unknow packet: " + e.getPacket().toString());

+                   log.warn("unknown packet: " + e.getPacket().toString());

                        } catch (Exception e) {

-                               // ignore SocketExceptions if we're closing the thread.

-                               if (quit && e instanceof SocketException) {

+                   // ignore IOExceptions if we're closing the thread.

+                   log.warn("quit: " + quit + " " + e.getMessage());

+                   if (quit && e instanceof IOException) {

                                        return;

                                }

 

@@ -83,8 +84,8 @@

                                        log.error("error on sendException to the session", e2);

                                }

 

-                               // IO exceptions? Close the connection!

-                               if (e instanceof IOException) {

+                   // SocketExceptions? Close the connection!

+                   if (e instanceof SocketException) {

                                        quit = true;

                                }

                        }

 

 

 

  • Guus der Kinderen KeyContributor 777 posts since
    Sep 8, 2005
    Currently Being Moderated
    Mar 31, 2008 2:45 AM (in response to richardl)
    Re: Calling session.logout causes IOException

    Clearspace is making a mess out of that patch. Could you please repost the message, (either the diff, or the entire method) and surround it in  tags?

    • Guus der Kinderen KeyContributor 777 posts since
      Sep 8, 2005
      Currently Being Moderated
      Apr 1, 2008 12:50 AM (in response to richardl)
      Re: Calling session.logout causes IOException
      public void run() {
               while (!quit) {
                try {
                    process(parentSession.network.receivePacket());
                } catch (UnknowServiceException e) {
                    log.warn("unknown packet: " + e.getPacket().toString());
                } catch (Exception e) {
                    // ignore IOExceptions if we're closing the thread.
                    log.warn("quit: " + quit + " " + e.getMessage());
                    if (quit && e instanceof IOException) {
                     return;
                    }
       
                    log.error("error on process packet", e);
                    try {
                     parentSession.sendExceptionEvent(e, "Source: InputThread");
                    } catch (Exception e2) {
                     log.error("error on sendException to the session", e2);
                    }
       
                    // SocketExceptions? Close the connection!
                    if (e instanceof SocketException) {
                     quit = true;
                    }
                }
               }
           }
       
      

       

      You do this by enclosing your code in two tags that look like this:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points