Changeset 78192cc7 in mainline for uspace/srv/net/tcp/ucall.c
- Timestamp:
- 2014-07-13T14:06:23Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- af2a76c, f303f2cf
- Parents:
- c1b979a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tcp/ucall.c
rc1b979a r78192cc7 90 90 /* Wait for connection to be established or reset */ 91 91 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open: Wait for connection."); 92 fibril_mutex_lock(&nconn->lock);92 tcp_conn_lock(nconn); 93 93 while (nconn->cstate == st_listen || 94 94 nconn->cstate == st_syn_sent || … … 100 100 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open: Connection was reset."); 101 101 assert(nconn->cstate == st_closed); 102 fibril_mutex_unlock(&nconn->lock);102 tcp_conn_unlock(nconn); 103 103 return TCP_ERESET; 104 104 } 105 105 106 fibril_mutex_unlock(&nconn->lock);106 tcp_conn_unlock(nconn); 107 107 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open: Connection was established."); 108 108 … … 121 121 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_uc_send()", conn->name); 122 122 123 fibril_mutex_lock(&conn->lock);123 tcp_conn_lock(conn); 124 124 125 125 if (conn->cstate == st_closed) { 126 fibril_mutex_unlock(&conn->lock);126 tcp_conn_unlock(conn); 127 127 return TCP_ENOTEXIST; 128 128 } … … 135 135 136 136 if (conn->snd_buf_fin) { 137 fibril_mutex_unlock(&conn->lock);137 tcp_conn_unlock(conn); 138 138 return TCP_ECLOSING; 139 139 } … … 149 149 150 150 if (conn->reset) { 151 fibril_mutex_unlock(&conn->lock);151 tcp_conn_unlock(conn); 152 152 return TCP_ERESET; 153 153 } … … 165 165 166 166 tcp_tqueue_new_data(conn); 167 fibril_mutex_unlock(&conn->lock);167 tcp_conn_unlock(conn); 168 168 169 169 return TCP_EOK; … … 178 178 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_uc_receive()", conn->name); 179 179 180 fibril_mutex_lock(&conn->lock);180 tcp_conn_lock(conn); 181 181 182 182 if (conn->cstate == st_closed) { 183 fibril_mutex_unlock(&conn->lock);183 tcp_conn_unlock(conn); 184 184 return TCP_ENOTEXIST; 185 185 } … … 197 197 if (conn->rcv_buf_fin) { 198 198 /* End of data, peer closed connection */ 199 fibril_mutex_unlock(&conn->lock);199 tcp_conn_unlock(conn); 200 200 return TCP_ECLOSING; 201 201 } else { 202 202 /* Connection was reset */ 203 203 assert(conn->reset); 204 fibril_mutex_unlock(&conn->lock);204 tcp_conn_unlock(conn); 205 205 return TCP_ERESET; 206 206 } … … 227 227 conn->name, xfer_size); 228 228 229 fibril_mutex_unlock(&conn->lock);229 tcp_conn_unlock(conn); 230 230 231 231 return TCP_EOK; … … 238 238 conn); 239 239 240 fibril_mutex_lock(&conn->lock);240 tcp_conn_lock(conn); 241 241 242 242 if (conn->cstate == st_closed) { 243 243 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_close - ENOTEXIST"); 244 fibril_mutex_unlock(&conn->lock);244 tcp_conn_unlock(conn); 245 245 return TCP_ENOTEXIST; 246 246 } … … 250 250 tcp_conn_reset(conn); 251 251 tcp_conn_remove(conn); 252 tcp_conn_unlock(conn); 252 253 return TCP_EOK; 253 254 } … … 255 256 if (conn->snd_buf_fin) { 256 257 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_close - ECLOSING"); 257 fibril_mutex_unlock(&conn->lock);258 tcp_conn_unlock(conn); 258 259 return TCP_ECLOSING; 259 260 } … … 263 264 tcp_tqueue_new_data(conn); 264 265 265 fibril_mutex_unlock(&conn->lock);266 tcp_conn_unlock(conn); 266 267 return TCP_EOK; 267 268 } … … 321 322 } 322 323 323 fibril_mutex_lock(&conn->lock);324 tcp_conn_lock(conn); 324 325 325 326 if (conn->cstate == st_closed) { 326 327 log_msg(LOG_DEFAULT, LVL_WARN, "Connection is closed."); 327 328 tcp_unexpected_segment(sp, seg); 328 fibril_mutex_unlock(&conn->lock);329 tcp_conn_unlock(conn); 329 330 tcp_conn_delref(conn); 330 331 return; … … 342 343 tcp_conn_segment_arrived(conn, seg); 343 344 344 fibril_mutex_unlock(&conn->lock);345 tcp_conn_unlock(conn); 345 346 tcp_conn_delref(conn); 346 347 }
Note:
See TracChangeset
for help on using the changeset viewer.