558 |
tcp_parseopt(pcb); |
tcp_parseopt(pcb); |
559 |
|
|
560 |
/* Call the user specified function to call when sucessfully |
/* Call the user specified function to call when sucessfully |
561 |
connected. */ |
* connected. */ |
562 |
TCP_EVENT_CONNECTED(pcb, ERR_OK, err); |
TCP_EVENT_CONNECTED(pcb, ERR_OK, err); |
563 |
tcp_ack(pcb); |
tcp_ack(pcb); |
564 |
} |
} |
567 |
if (flags & TCP_ACK && |
if (flags & TCP_ACK && |
568 |
!(flags & TCP_RST)) { |
!(flags & TCP_RST)) { |
569 |
if (TCP_SEQ_LT(pcb->lastack, ackno) && |
if (TCP_SEQ_LT(pcb->lastack, ackno) && |
570 |
TCP_SEQ_LEQ(ackno, pcb->snd_nxt)) { |
TCP_SEQ_LEQ(ackno, pcb->snd_nxt)) { |
571 |
pcb->state = ESTABLISHED; |
pcb->state = ESTABLISHED; |
572 |
LWIP_DEBUGF(DEMO_DEBUG, ("TCP connection established %u -> %u.\n", inseg.tcphdr->src, inseg.tcphdr->dest)); |
LWIP_DEBUGF(DEMO_DEBUG, ("TCP connection established %u -> %u.\n", inseg.tcphdr->src, inseg.tcphdr->dest)); |
573 |
LWIP_ASSERT("pcb->accept != NULL", pcb->accept != NULL); |
#if LWIP_CALLBACK_API |
574 |
/* Call the accept function. */ |
LWIP_ASSERT("pcb->accept != NULL", pcb->accept != NULL); |
575 |
TCP_EVENT_ACCEPT(pcb, ERR_OK, err); |
#endif |
576 |
if (err != ERR_OK) { |
/* Call the accept function. */ |
577 |
/* If the accept function returns with an error, we abort |
TCP_EVENT_ACCEPT(pcb, ERR_OK, err); |
578 |
the connection. */ |
if (err != ERR_OK) { |
579 |
tcp_abort(pcb); |
/* If the accept function returns with an error, we abort |
580 |
return ERR_ABRT; |
* the connection. */ |
581 |
} |
tcp_abort(pcb); |
582 |
/* If there was any data contained within this ACK, |
return ERR_ABRT; |
583 |
we'd better pass it on to the application as well. */ |
} |
584 |
tcp_receive(pcb); |
/* If there was any data contained within this ACK, |
585 |
pcb->cwnd = pcb->mss; |
* we'd better pass it on to the application as well. */ |
586 |
|
tcp_receive(pcb); |
587 |
|
pcb->cwnd = pcb->mss; |
588 |
} |
} |
589 |
} |
} |
590 |
break; |
break; |