Changeset 78192cc7 in mainline for uspace/srv/net/tcp/conn.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/conn.c
rc1b979a r78192cc7 78 78 goto error; 79 79 80 conn->tw_timer = fibril_timer_create(); 80 fibril_mutex_initialize(&conn->lock); 81 82 conn->tw_timer = fibril_timer_create(&conn->lock); 81 83 if (conn->tw_timer == NULL) 82 84 goto error; 83 84 fibril_mutex_initialize(&conn->lock);85 85 86 86 /* One for the user, one for not being in closed state */ … … 200 200 if (atomic_predec(&conn->refcnt) == 0) 201 201 tcp_conn_free(conn); 202 } 203 204 /** Lock connection. 205 * 206 * Must be called before any other connection-manipulating function, 207 * except tcp_conn_{add|del}ref(). Locks the connection including 208 * its timers. Must not be called inside any of the connection 209 * timer handlers. 210 * 211 * @param conn Connection 212 */ 213 void tcp_conn_lock(tcp_conn_t *conn) 214 { 215 fibril_mutex_lock(&conn->lock); 216 } 217 218 /** Unlock connection. 219 * 220 * @param conn Connection 221 */ 222 void tcp_conn_unlock(tcp_conn_t *conn) 223 { 224 fibril_mutex_unlock(&conn->lock); 202 225 } 203 226 … … 1183 1206 log_msg(LOG_DEFAULT, LVL_DEBUG, "tw_timeout_func(%p)", conn); 1184 1207 1185 fibril_mutex_lock(&conn->lock);1208 tcp_conn_lock(conn); 1186 1209 1187 1210 if (conn->cstate == st_closed) { 1188 1211 log_msg(LOG_DEFAULT, LVL_DEBUG, "Connection already closed."); 1189 fibril_mutex_unlock(&conn->lock);1212 tcp_conn_unlock(conn); 1190 1213 tcp_conn_delref(conn); 1191 1214 return; … … 1196 1219 tcp_conn_state_set(conn, st_closed); 1197 1220 1198 fibril_mutex_unlock(&conn->lock);1221 tcp_conn_unlock(conn); 1199 1222 tcp_conn_delref(conn); 1223 1224 log_msg(LOG_DEFAULT, LVL_DEBUG, "tw_timeout_func(%p) end", conn); 1200 1225 } 1201 1226 … … 1206 1231 void tcp_conn_tw_timer_set(tcp_conn_t *conn) 1207 1232 { 1233 log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_conn_tw_timer_set() begin"); 1208 1234 tcp_conn_addref(conn); 1209 fibril_timer_set(conn->tw_timer, TIME_WAIT_TIMEOUT, tw_timeout_func, 1210 (void *)conn); 1235 fibril_timer_set_locked(conn->tw_timer, TIME_WAIT_TIMEOUT, 1236 tw_timeout_func, (void *)conn); 1237 log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_conn_tw_timer_set() end"); 1211 1238 } 1212 1239 … … 1217 1244 void tcp_conn_tw_timer_clear(tcp_conn_t *conn) 1218 1245 { 1219 if (fibril_timer_clear(conn->tw_timer) == fts_active) 1246 log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_conn_tw_timer_clear() begin"); 1247 if (fibril_timer_clear_locked(conn->tw_timer) == fts_active) 1220 1248 tcp_conn_delref(conn); 1249 log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_conn_tw_timer_clear() end"); 1221 1250 } 1222 1251
Note:
See TracChangeset
for help on using the changeset viewer.