+ }
+
+ /*
+ * See which queue to get next packet from
+ * If there's something in the fastq, select it immediately
+ */
+ if (slirp->if_fastq.ifq_next != &slirp->if_fastq) {
+ ifm = slirp->if_fastq.ifq_next;
+ } else {
+ /* Nothing on fastq, pick up from batchq via next_m */
+ ifm = slirp->next_m;
+ from_batchq = true;
+ }
+
+ slirp->if_queued--;
+
+ /* Try to send packet unless it already expired */
+ if (ifm->expiration_date >= now && !if_encap(slirp, ifm)) {
+ /* Packet is delayed due to pending ARP resolution */
+ requeued++;
+ continue;
+ }
+
+ if (from_batchq) {
+ /* Set which packet to send on next iteration */
+ slirp->next_m = ifm->ifq_next;
+ }
+
+ /* Remove it from the queue */
+ ifqt = ifm->ifq_prev;
+ remque(ifm);
+
+ /* If there are more packets for this session, re-queue them */
+ if (ifm->ifs_next != ifm) {
+ insque(ifm->ifs_next, ifqt);
+ ifs_remque(ifm);
+ /* Set next_m if the session packet is now the only one on
+ * batchq */
+ if (ifqt == &slirp->if_batchq &&
+ slirp->next_m == &slirp->if_batchq) {
+ slirp->next_m = ifm->ifs_next;
+ }
+ }
+
+ /* Update so_queued */
+ if (ifm->ifq_so && --ifm->ifq_so->so_queued == 0) {
+ /* If there's no more queued, reset nqueued */
+ ifm->ifq_so->so_nqueued = 0;
+ }