[jboss-jira] [JBoss JIRA] (JGRP-1736) UDP: Android does not reset buffer length

Bela Ban (JIRA) jira-events at lists.jboss.org
Fri Nov 8 02:23:02 EST 2013


Bela Ban created JGRP-1736:
------------------------------

             Summary: UDP: Android does not reset buffer length
                 Key: JGRP-1736
                 URL: https://issues.jboss.org/browse/JGRP-1736
             Project: JGroups
          Issue Type: Bug
            Reporter: Bela Ban
            Assignee: Bela Ban
            Priority: Minor
             Fix For: 3.4.1, 3.5


Discussion at http://jgroups.1086181.n5.nabble.com/jgroups-users-PLEASE-HELP-ME-OUT-FOR-quot-JGroup-with-Android-quot-problem-td9537i20.html:
Hi, Belaban..I think I have found the problem...after discovering this issue occurs only on all ICS devices I have and after reading through the "Android issue #24748 DatagramPacket truncated UDP" at http://code.google.com/p/android/issues/detail?id=24748, I have introduced the following modification at org.jgroups.protocols.UDP.java:

      public void run() {
            final byte           receive_buf[]=new byte[66000]; // to be on the safe side (IPv6 == 65575 bytes, IPv4 = 65535)
            final DatagramPacket packet=new DatagramPacket(receive_buf, receive_buf.length);

            while(thread != null && Thread.currentThread().equals(thread)) {
                try {
               
                    //Solved Android ISSUE #24748 - DatagramPacket truncated UDP in ICS
                    if (Util.checkForAndroid())
                        packet.setLength(receive_buf.length);
                       
                    receiver_socket.receive(packet);
                    int len=packet.getLength();
                   
                    ...
                }
                catch(SocketException sock_ex) {
                    ...
                }
                catch(Throwable ex) {
                    ...
                }
            }

            ...
        }

It seems to solve the EOFException but I am not sure the real impact on Jgroups library as a whole. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list