382 } |
382 } |
383 } |
383 } |
384 if (packetAddress == NULL) { |
384 if (packetAddress == NULL) { |
385 packetAddress = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, |
385 packetAddress = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa, |
386 &port); |
386 &port); |
387 /* stuff the new Inetaddress into the packet */ |
387 if (packetAddress != NULL) { |
388 (*env)->SetObjectField(env, dpObj, dp_addressID, packetAddress); |
388 /* stuff the new Inetaddress into the packet */ |
389 } |
389 (*env)->SetObjectField(env, dpObj, dp_addressID, packetAddress); |
390 |
390 } |
391 /* populate the packet */ |
391 } |
392 (*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, rv, |
392 |
|
393 if (!(*env)->ExceptionCheck(env)) { |
|
394 /* populate the packet */ |
|
395 (*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, rv, |
393 (jbyte *)fullPacket); |
396 (jbyte *)fullPacket); |
394 (*env)->SetIntField(env, dpObj, dp_portID, port); |
397 (*env)->SetIntField(env, dpObj, dp_portID, port); |
395 (*env)->SetIntField(env, dpObj, dp_lengthID, rv); |
398 (*env)->SetIntField(env, dpObj, dp_lengthID, rv); |
|
399 } |
396 } |
400 } |
397 |
401 |
398 if (packetBufferLen > MAX_BUFFER_LEN) { |
402 if (packetBufferLen > MAX_BUFFER_LEN) { |
399 free(fullPacket); |
403 free(fullPacket); |
400 } |
404 } |