Changeset b243da3 in mainline
- Timestamp:
- 2013-09-28T20:41:51Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 13be2583
- Parents:
- 04ecc6d
- Location:
- uspace/srv/net/tcp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tcp/conn.c
r04ecc6d rb243da3 381 381 * @param conn Connection 382 382 */ 383 staticvoid tcp_conn_reset(tcp_conn_t *conn)383 void tcp_conn_reset(tcp_conn_t *conn) 384 384 { 385 385 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_conn_reset()", conn->name); -
uspace/srv/net/tcp/conn.h
r04ecc6d rb243da3 43 43 extern void tcp_conn_add(tcp_conn_t *); 44 44 extern void tcp_conn_remove(tcp_conn_t *); 45 extern void tcp_conn_reset(tcp_conn_t *conn); 45 46 extern void tcp_conn_sync(tcp_conn_t *); 46 47 extern void tcp_conn_fin_sent(tcp_conn_t *); -
uspace/srv/net/tcp/sock.c
r04ecc6d rb243da3 882 882 tcp_sockdata_t *socket; 883 883 tcp_error_t trc; 884 int i; 884 885 int rc; 885 886 … … 897 898 898 899 if (socket->conn != NULL) { 900 /* Close connection */ 899 901 trc = tcp_uc_close(socket->conn); 900 902 if (trc != TCP_EOK && trc != TCP_ENOTEXIST) { … … 905 907 } 906 908 909 if (socket->lconn != NULL) { 910 /* Close listening connections */ 911 for (i = 0; i < socket->backlog; i++) { 912 tcp_uc_set_cstate_cb(socket->lconn[i]->conn, NULL, NULL); 913 trc = tcp_uc_close(socket->lconn[i]->conn); 914 if (trc != TCP_EOK && trc != TCP_ENOTEXIST) { 915 fibril_mutex_unlock(&socket->lock); 916 async_answer_0(callid, EBADF); 917 return; 918 } 919 920 free(socket->lconn[i]); 921 socket->lconn[i] = NULL; 922 } 923 } 924 907 925 /* Grab recv_buffer_lock because of CV wait in tcp_sock_recv_fibril() */ 908 926 fibril_mutex_lock(&socket->recv_buffer_lock); -
uspace/srv/net/tcp/ucall.c
r04ecc6d rb243da3 83 83 84 84 if (oflags == tcp_open_nonblock) { 85 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open -> %p", nconn); 85 86 *conn = nconn; 86 87 return TCP_EOK; … … 234 235 tcp_error_t tcp_uc_close(tcp_conn_t *conn) 235 236 { 236 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_uc_close()", conn->name); 237 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_uc_close(%p)", conn->name, 238 conn); 237 239 238 240 fibril_mutex_lock(&conn->lock); 239 241 240 242 if (conn->cstate == st_closed) { 243 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_close - ENOTEXIST"); 241 244 fibril_mutex_unlock(&conn->lock); 242 245 return TCP_ENOTEXIST; 243 246 } 244 247 248 if (conn->cstate == st_listen || conn->cstate == st_syn_sent) { 249 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_close - listen/syn_sent"); 250 tcp_conn_reset(conn); 251 tcp_conn_remove(conn); 252 return TCP_EOK; 253 } 254 245 255 if (conn->snd_buf_fin) { 256 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_close - ECLOSING"); 246 257 fibril_mutex_unlock(&conn->lock); 247 258 return TCP_ECLOSING; 248 259 } 249 260 261 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_close - set snd_buf_fin"); 250 262 conn->snd_buf_fin = true; 251 263 tcp_tqueue_new_data(conn);
Note:
See TracChangeset
for help on using the changeset viewer.