Changeset a4ee3ab2 in mainline for uspace/srv/net/tl/tcp/ucall.c
- Timestamp:
- 2011-11-29T22:51:27Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8fcf74f
- Parents:
- 04cd242
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tl/tcp/ucall.c
r04cd242 ra4ee3ab2 57 57 * XXX We should be able to call active open on an existing listening 58 58 * connection. 59 * XXX We should be able to get connection structure immediately, before 60 * establishment. 59 61 */ 60 62 tcp_error_t tcp_uc_open(uint16_t lport, tcp_sock_t *fsock, acpass_t acpass, … … 77 79 /* Synchronize (initiate) connection */ 78 80 tcp_conn_sync(nconn); 79 80 /* Wait for connection to be established or reset */ 81 log_msg(LVL_DEBUG, "tcp_uc_open: Wait for connection.");82 fibril_mutex_lock(&nconn->cstate_lock);83 while (nconn->cstate == st_syn_sent ||84 nconn->cstate == st_syn_received) {85 fibril_condvar_wait(&nconn->cstate_cv, &nconn->cstate_lock);86 }87 if (nconn->cstate != st_established) {88 log_msg(LVL_DEBUG, "tcp_uc_open: Connection was reset.");89 assert(nconn->cstate == st_closed); 90 fibril_mutex_unlock(&nconn->cstate_lock);91 return TCP_ERESET;92 }81 } 82 83 /* Wait for connection to be established or reset */ 84 log_msg(LVL_DEBUG, "tcp_uc_open: Wait for connection."); 85 fibril_mutex_lock(&nconn->cstate_lock); 86 while (nconn->cstate == st_listen || 87 nconn->cstate == st_syn_sent || 88 nconn->cstate == st_syn_received) { 89 fibril_condvar_wait(&nconn->cstate_cv, &nconn->cstate_lock); 90 } 91 92 if (nconn->cstate != st_established) { 93 log_msg(LVL_DEBUG, "tcp_uc_open: Connection was reset."); 94 assert(nconn->cstate == st_closed); 93 95 fibril_mutex_unlock(&nconn->cstate_lock); 94 log_msg(LVL_DEBUG, "tcp_uc_open: Connection was established."); 95 } 96 return TCP_ERESET; 97 } 98 99 fibril_mutex_unlock(&nconn->cstate_lock); 100 log_msg(LVL_DEBUG, "tcp_uc_open: Connection was established."); 96 101 97 102 *conn = nconn;
Note:
See TracChangeset
for help on using the changeset viewer.