Changes in uspace/srv/net/tcp/tqueue.c [9520af7:7c15d6f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tcp/tqueue.c
r9520af7 r7c15d6f 43 43 #include <mem.h> 44 44 #include <stdlib.h> 45 46 45 #include "conn.h" 47 #include "inet.h"48 46 #include "ncsim.h" 47 #include "pdu.h" 49 48 #include "rqueue.h" 50 49 #include "segment.h" 51 50 #include "seq_no.h" 52 51 #include "tqueue.h" 52 #include "tcp.h" 53 53 #include "tcp_type.h" 54 54 55 55 #define RETRANSMIT_TIMEOUT (2*1000*1000) 56 56 57 static void retransmit_timeout_func(void *); 58 static void tcp_tqueue_timer_set(tcp_conn_t *); 59 static void tcp_tqueue_timer_clear(tcp_conn_t *); 60 static void tcp_tqueue_seg(tcp_conn_t *, tcp_segment_t *); 61 static void tcp_conn_transmit_segment(tcp_conn_t *, tcp_segment_t *); 62 static void tcp_prepare_transmit_segment(tcp_conn_t *, tcp_segment_t *); 63 static void tcp_tqueue_send_immed(tcp_conn_t *, tcp_segment_t *); 64 65 int tcp_tqueue_init(tcp_tqueue_t *tqueue, tcp_conn_t *conn, 66 tcp_tqueue_cb_t *cb) 57 static void retransmit_timeout_func(void *arg); 58 static void tcp_tqueue_timer_set(tcp_conn_t *conn); 59 static void tcp_tqueue_timer_clear(tcp_conn_t *conn); 60 61 int tcp_tqueue_init(tcp_tqueue_t *tqueue, tcp_conn_t *conn) 67 62 { 68 63 tqueue->conn = conn; 69 64 tqueue->timer = fibril_timer_create(&conn->lock); 70 tqueue->cb = cb;71 65 if (tqueue->timer == NULL) 72 66 return ENOMEM; … … 84 78 void tcp_tqueue_fini(tcp_tqueue_t *tqueue) 85 79 { 86 link_t *link;87 tcp_tqueue_entry_t *tqe;88 89 80 if (tqueue->timer != NULL) { 90 81 fibril_timer_destroy(tqueue->timer); 91 82 tqueue->timer = NULL; 92 83 } 93 94 while (!list_empty(&tqueue->list)) {95 link = list_first(&tqueue->list);96 tqe = list_get_instance(link, tcp_tqueue_entry_t, link);97 list_remove(link);98 99 tcp_segment_delete(tqe->seg);100 free(tqe);101 }102 84 } 103 85 … … 105 87 { 106 88 tcp_segment_t *seg; 107 108 assert(fibril_mutex_is_locked(&conn->lock));109 89 110 90 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_tqueue_ctrl_seg(%p, %u)", conn, ctrl); … … 115 95 } 116 96 117 staticvoid tcp_tqueue_seg(tcp_conn_t *conn, tcp_segment_t *seg)97 void tcp_tqueue_seg(tcp_conn_t *conn, tcp_segment_t *seg) 118 98 { 119 99 tcp_segment_t *rt_seg; 120 100 tcp_tqueue_entry_t *tqe; 121 122 assert(fibril_mutex_is_locked(&conn->lock));123 101 124 102 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_tqueue_seg(%p, %p)", conn->name, conn, … … 157 135 } 158 136 159 staticvoid tcp_prepare_transmit_segment(tcp_conn_t *conn, tcp_segment_t *seg)137 void tcp_prepare_transmit_segment(tcp_conn_t *conn, tcp_segment_t *seg) 160 138 { 161 139 /* … … 289 267 } 290 268 291 staticvoid tcp_conn_transmit_segment(tcp_conn_t *conn, tcp_segment_t *seg)269 void tcp_conn_transmit_segment(tcp_conn_t *conn, tcp_segment_t *seg) 292 270 { 293 271 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_conn_transmit_segment(%p, %p)", … … 301 279 seg->ack = 0; 302 280 303 tcp_t queue_send_immed(conn, seg);304 } 305 306 void tcp_t queue_send_immed(tcp_conn_t *conn, tcp_segment_t *seg)281 tcp_transmit_segment(&conn->ident, seg); 282 } 283 284 void tcp_transmit_segment(inet_ep2_t *epp, tcp_segment_t *seg) 307 285 { 308 286 log_msg(LOG_DEFAULT, LVL_DEBUG, 309 "tcp_t queue_send_immed(l:(%u),f:(%u), %p)",310 conn->ident.local.port, conn->ident.remote.port, seg);287 "tcp_transmit_segment(l:(%u),f:(%u), %p)", 288 epp->local.port, epp->remote.port, seg); 311 289 312 290 log_msg(LOG_DEFAULT, LVL_DEBUG, "SEG.SEQ=%" PRIu32 ", SEG.WND=%" PRIu32, … … 314 292 315 293 tcp_segment_dump(seg); 316 317 conn->retransmit.cb->transmit_seg(&conn->ident, seg); 294 /* 295 tcp_pdu_prepare(conn, seg, &data, &len); 296 tcp_pdu_transmit(data, len); 297 */ 298 // tcp_rqueue_bounce_seg(sp, seg); 299 // tcp_ncsim_bounce_seg(sp, seg); 300 301 tcp_pdu_t *pdu; 302 303 if (tcp_pdu_encode(epp, seg, &pdu) != EOK) { 304 log_msg(LOG_DEFAULT, LVL_WARN, "Not enough memory. Segment dropped."); 305 return; 306 } 307 308 tcp_transmit_pdu(pdu); 309 tcp_pdu_delete(pdu); 318 310 } 319 311 … … 370 362 static void tcp_tqueue_timer_set(tcp_conn_t *conn) 371 363 { 372 assert(fibril_mutex_is_locked(&conn->lock));373 374 364 log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_set() begin", conn->name); 375 365 … … 387 377 static void tcp_tqueue_timer_clear(tcp_conn_t *conn) 388 378 { 389 assert(fibril_mutex_is_locked(&conn->lock));390 391 379 log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_clear() begin", conn->name); 392 380
Note:
See TracChangeset
for help on using the changeset viewer.