this.haveFirstFragment |= (myFrOfs == 0);
this.haveLastFragment |= !hdr.hasMoreFragments();
// Insert the fragment at the correct index in the list
for (Iterator<SocketBuffer> i = fragments.iterator(); i.hasNext();) {
final SocketBuffer f = (SocketBuffer) i.next();
final IPv4Header fhdr = (IPv4Header) f.getNetworkLayerHeader();
final int fOfs = fhdr.getFragmentOffset();
final int fSize = f.getSize();
if (myFrOfs == (fOfs + fSize)) {
// skbuf directly follows f, attach it.
f.append(skbuf);
// See if we can attach the following fragment directly to me
if (i.hasNext()) {
final SocketBuffer f2 = (SocketBuffer) i.next();
final IPv4Header f2hdr = (IPv4Header) f2.getNetworkLayerHeader();
final int f2Ofs = f2hdr.getFragmentOffset();
if (f2Ofs == (myFrOfs + skbuf.getSize())) {
// Yes we can attach it
skbuf.append(f2);
fragments.remove(f2);