Changeset bbf159a in mainline
- Timestamp:
- 2011-12-13T17:06:25Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7a8c1c4e
- Parents:
- 0d29e0cd
- Location:
- uspace/srv/net/tl/tcp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tl/tcp/conn.c
r0d29e0cd rbbf159a 93 93 94 94 /** Allocate send buffer */ 95 fibril_mutex_initialize(&conn->snd_buf_lock); 96 fibril_condvar_initialize(&conn->snd_buf_cv); 95 97 conn->snd_buf_size = SND_BUF_SIZE; 96 98 conn->snd_buf_used = 0; … … 287 289 288 290 fibril_condvar_broadcast(&conn->rcv_buf_cv); 291 fibril_condvar_broadcast(&conn->snd_buf_cv); 289 292 } 290 293 -
uspace/srv/net/tl/tcp/tcp_type.h
r0d29e0cd rbbf159a 204 204 /** Send buffer contains FIN */ 205 205 bool snd_buf_fin; 206 /** Send buffer lock */ 207 fibril_mutex_t snd_buf_lock; 208 /** Send buffer CV. Broadcast when space is made available in buffer */ 209 fibril_condvar_t snd_buf_cv; 206 210 207 211 /** Send unacknowledged */ -
uspace/srv/net/tl/tcp/tqueue.c
r0d29e0cd rbbf159a 167 167 log_msg(LVL_DEBUG, "%s: tcp_tqueue_new_data()", conn->name); 168 168 169 fibril_mutex_lock(&conn->snd_buf_lock); 170 169 171 /* Number of free sequence numbers in send window */ 170 172 avail_wnd = (conn->snd_una + conn->snd_wnd) - conn->snd_nxt; … … 176 178 xfer_seqlen); 177 179 178 if (xfer_seqlen == 0) 179 return; 180 if (xfer_seqlen == 0) { 181 fibril_mutex_unlock(&conn->snd_buf_lock); 182 return; 183 } 180 184 181 185 /* XXX Do not always send immediately */ … … 188 192 /* We are sending out FIN */ 189 193 ctrl = CTL_FIN; 190 tcp_conn_fin_sent(conn);191 194 } else { 192 195 ctrl = 0; … … 195 198 seg = tcp_segment_make_data(ctrl, conn->snd_buf, data_size); 196 199 if (seg == NULL) { 200 fibril_mutex_unlock(&conn->snd_buf_lock); 197 201 log_msg(LVL_ERROR, "Memory allocation failure."); 198 202 return; … … 206 210 if (send_fin) 207 211 conn->snd_buf_fin = false; 212 213 fibril_condvar_broadcast(&conn->snd_buf_cv); 214 fibril_mutex_unlock(&conn->snd_buf_lock); 215 216 if (send_fin) 217 tcp_conn_fin_sent(conn); 208 218 209 219 tcp_tqueue_seg(conn, seg); -
uspace/srv/net/tl/tcp/ucall.c
r0d29e0cd rbbf159a 121 121 } 122 122 123 if (conn->snd_buf_fin) 123 fibril_mutex_lock(&conn->snd_buf_lock); 124 125 if (conn->snd_buf_fin) { 126 fibril_mutex_unlock(&conn->snd_buf_lock); 124 127 return TCP_ECLOSING; 128 } 125 129 126 130 while (size > 0) { 127 131 buf_free = conn->snd_buf_size - conn->snd_buf_used; 128 132 while (buf_free == 0 && !conn->reset) { 129 tcp_tqueue_new_data(conn); 133 log_msg(LVL_DEBUG, "%s: buf_free == 0, waiting.", 134 conn->name); 135 fibril_condvar_wait(&conn->snd_buf_cv, 136 &conn->snd_buf_lock); 130 137 buf_free = conn->snd_buf_size - conn->snd_buf_used; 131 138 } 132 139 133 if (conn->reset) 140 if (conn->reset) { 141 fibril_mutex_unlock(&conn->snd_buf_lock); 134 142 return TCP_ERESET; 143 } 135 144 136 145 xfer_size = min(size, buf_free); … … 141 150 conn->snd_buf_used += xfer_size; 142 151 size -= xfer_size; 143 } 144 152 153 fibril_mutex_unlock(&conn->snd_buf_lock); 154 tcp_tqueue_new_data(conn); 155 fibril_mutex_lock(&conn->snd_buf_lock); 156 } 157 158 fibril_mutex_unlock(&conn->snd_buf_lock); 145 159 tcp_tqueue_new_data(conn); 146 160
Note:
See TracChangeset
for help on using the changeset viewer.