Changeset f343a16 in mainline
- Timestamp:
- 2011-10-23T23:43:38Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6df418c4
- Parents:
- 32aea9f4
- Location:
- uspace/srv/net/tl/tcp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tl/tcp/conn.c
r32aea9f4 rf343a16 130 130 tcp_tqueue_ctrl_seg(conn, CTL_SYN); 131 131 conn->cstate = st_syn_sent; 132 } 133 134 /** FIN has been sent. 135 * 136 * This function should be called when FIN is sent over the connection, 137 * as a result the connection state is changed appropriately. 138 */ 139 void tcp_conn_fin_sent(tcp_conn_t *conn) 140 { 141 switch (conn->cstate) { 142 case st_syn_received: 143 case st_established: 144 log_msg(LVL_DEBUG, "FIN sent -> Fin-Wait-1"); 145 conn->cstate = st_fin_wait_1; 146 break; 147 case st_close_wait: 148 log_msg(LVL_DEBUG, "FIN sent -> Close-Wait"); 149 conn->cstate = st_last_ack; 150 break; 151 default: 152 assert(false); 153 } 132 154 } 133 155 … … 734 756 conn->rcv_wnd--; 735 757 736 /* TODO Change connection state */ 758 /* Change connection state */ 759 switch (conn->cstate) { 760 case st_listen: 761 case st_syn_sent: 762 case st_closed: 763 /* Connection not synchronized */ 764 assert(false); 765 case st_syn_received: 766 case st_established: 767 log_msg(LVL_DEBUG, "FIN received -> Close-Wait"); 768 conn->cstate = st_close_wait; 769 break; 770 case st_fin_wait_1: 771 log_msg(LVL_DEBUG, "FIN received -> Closing"); 772 conn->cstate = st_closing; 773 break; 774 case st_fin_wait_2: 775 log_msg(LVL_DEBUG, "FIN received -> Time-Wait"); 776 conn->cstate = st_time_wait; 777 /* XXX start time-wait timer */ 778 break; 779 case st_close_wait: 780 case st_closing: 781 case st_last_ack: 782 /* Do nothing */ 783 break; 784 case st_time_wait: 785 /* XXX Restart the 2 MSL time-wait timeout */ 786 break; 787 } 737 788 738 789 /* Add FIN to the receive buffer */ -
uspace/srv/net/tl/tcp/conn.h
r32aea9f4 rf343a16 42 42 void tcp_conn_add(tcp_conn_t *); 43 43 extern void tcp_conn_sync(tcp_conn_t *); 44 extern void tcp_conn_fin_sent(tcp_conn_t *); 44 45 extern tcp_conn_t *tcp_conn_find(tcp_sockpair_t *); 45 46 extern bool tcp_conn_got_syn(tcp_conn_t *); -
uspace/srv/net/tl/tcp/tqueue.c
r32aea9f4 rf343a16 119 119 /* We are sending out FIN */ 120 120 ctrl = CTL_FIN; 121 tcp_conn_fin_sent(conn); 121 122 } else { 122 123 ctrl = 0;
Note:
See TracChangeset
for help on using the changeset viewer.