harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From regi...@apache.org
Subject svn commit: r921706 - /harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java
Date Thu, 11 Mar 2010 06:43:10 GMT
Author: regisxu
Date: Thu Mar 11 06:43:10 2010
New Revision: 921706

URL: http://svn.apache.org/viewvc?rev=921706&view=rev
Log:
Apply fix for HARMONY-6378: [classlib][nio]DatagramChannelImpl uses wrong portlib API when
it is in connected status

Modified:
    harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java

Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java?rev=921706&r1=921705&r2=921706&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/DatagramChannelImpl.java
Thu Mar 11 06:43:10 2010
@@ -386,9 +386,14 @@ class DatagramChannelImpl extends Datagr
                 synchronized (writeLock) {
                     long data_address = AddressUtil
                             .getDirectBufferAddress(source);
-                    sendCount = networkSystem.sendDatagramDirect(fd,
-                            data_address, start, length, isa.getPort(), false,
-                            trafficClass, isa.getAddress());
+                    if (isConnected()) {
+                        sendCount = networkSystem.sendConnectedDatagramDirect(
+                                fd, data_address, start, length, false);
+                    } else {
+                        sendCount = networkSystem.sendDatagramDirect(fd,
+                                data_address, start, length, isa.getPort(),
+                                false, trafficClass, isa.getAddress());
+                    }
                 }
             } else {
                 if (source.hasArray()) {
@@ -400,9 +405,14 @@ class DatagramChannelImpl extends Datagr
                     start = 0;
                 }
                 synchronized (writeLock) {
-                    sendCount = networkSystem.sendDatagram(fd, array, start,
-                            length, isa.getPort(), false, trafficClass, isa
-                                    .getAddress());
+                    if (isConnected()) {
+                        sendCount = networkSystem.sendConnectedDatagram(fd,
+                                array, start, length, false);
+                    } else {
+                        sendCount = networkSystem.sendDatagram(fd, array,
+                                start, length, isa.getPort(), false,
+                                trafficClass, isa.getAddress());
+                    }
                 }
             }
             source.position(oldposition + sendCount);



Mime
View raw message