c->src = src;
c->dst = dst;
+#ifdef UTCP_DEBUG
+#warning debugging
+ c->snd.iss = 0;
+#else
c->snd.iss = rand();
+#endif
c->snd.una = c->snd.iss;
c->snd.nxt = c->snd.iss + 1;
c->rcv.wnd = utcp->mtu;
} *pkt;
pkt = malloc(sizeof pkt->hdr + c->utcp->mtu);
- if(!pkt->data)
+ if(!pkt)
return;
pkt->hdr.src = c->src;
len--;
pkt->hdr.ctl |= FIN;
}
+ c->snd.nxt = c->snd.una + len;
buffer_copy(&c->sndbuf, pkt->data, 0, len);
print_packet(c->utcp, "rtrx", pkt, sizeof pkt->hdr + len);
utcp->send(utcp, pkt, sizeof pkt->hdr + len);
}
int utcp_shutdown(struct utcp_connection *c, int dir) {
- debug("%p shutdown %d at %u\n", c ? c->utcp : NULL, dir, c->snd.last);
+ debug("%p shutdown %d at %u\n", c ? c->utcp : NULL, dir, c ? c->snd.last : 0);
if(!c) {
errno = EFAULT;
return -1;