|
@@ -492,6 +492,7 @@ static struct tcp_connection * tcp_demux ( uint16_t local_port ) {
|
492
|
492
|
* @ret rc Return status code
|
493
|
493
|
*/
|
494
|
494
|
static int tcp_rx_syn ( struct tcp_connection *conn, uint32_t seq ) {
|
|
495
|
+ struct tcp_application *app = conn->app;
|
495
|
496
|
|
496
|
497
|
/* Synchronise sequence numbers on first SYN */
|
497
|
498
|
if ( ! ( conn->tcp_state & TCP_STATE_RCVD ( TCP_SYN ) ) )
|
|
@@ -508,6 +509,11 @@ static int tcp_rx_syn ( struct tcp_connection *conn, uint32_t seq ) {
|
508
|
509
|
/* Acknowledge SYN */
|
509
|
510
|
conn->rcv_ack++;
|
510
|
511
|
|
|
512
|
+ /* Notify application of established connection, if applicable */
|
|
513
|
+ if ( ( conn->tcp_state & TCP_STATE_ACKED ( TCP_SYN ) ) &&
|
|
514
|
+ app && app->tcp_op->connected )
|
|
515
|
+ app->tcp_op->connected ( app );
|
|
516
|
+
|
511
|
517
|
return 0;
|
512
|
518
|
}
|
513
|
519
|
|
|
@@ -565,7 +571,9 @@ static int tcp_rx_ack ( struct tcp_connection *conn, uint32_t ack,
|
565
|
571
|
conn->tcp_state |= TCP_STATE_ACKED ( acked_flags );
|
566
|
572
|
|
567
|
573
|
/* Notify application of established connection, if applicable */
|
568
|
|
- if ( ( acked_flags & TCP_SYN ) && app && app->tcp_op->connected )
|
|
574
|
+ if ( ( acked_flags & TCP_SYN ) &&
|
|
575
|
+ ( conn->tcp_state & TCP_STATE_RCVD ( TCP_SYN ) ) &&
|
|
576
|
+ app && app->tcp_op->connected )
|
569
|
577
|
app->tcp_op->connected ( app );
|
570
|
578
|
|
571
|
579
|
return 0;
|