Changes in uspace/srv/net/tcp/conn.c [78192cc7:b243da3] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tcp/conn.c
r78192cc7 rb243da3 78 78 goto error; 79 79 80 fibril_mutex_initialize(&conn->lock); 81 82 conn->tw_timer = fibril_timer_create(&conn->lock); 80 conn->tw_timer = fibril_timer_create(); 83 81 if (conn->tw_timer == NULL) 84 82 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 including208 * its timers. Must not be called inside any of the connection209 * timer handlers.210 *211 * @param conn Connection212 */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 Connection221 */222 void tcp_conn_unlock(tcp_conn_t *conn)223 {224 fibril_mutex_unlock(&conn->lock);225 202 } 226 203 … … 1206 1183 log_msg(LOG_DEFAULT, LVL_DEBUG, "tw_timeout_func(%p)", conn); 1207 1184 1208 tcp_conn_lock(conn);1185 fibril_mutex_lock(&conn->lock); 1209 1186 1210 1187 if (conn->cstate == st_closed) { 1211 1188 log_msg(LOG_DEFAULT, LVL_DEBUG, "Connection already closed."); 1212 tcp_conn_unlock(conn);1189 fibril_mutex_unlock(&conn->lock); 1213 1190 tcp_conn_delref(conn); 1214 1191 return; … … 1219 1196 tcp_conn_state_set(conn, st_closed); 1220 1197 1221 tcp_conn_unlock(conn);1198 fibril_mutex_unlock(&conn->lock); 1222 1199 tcp_conn_delref(conn); 1223 1224 log_msg(LOG_DEFAULT, LVL_DEBUG, "tw_timeout_func(%p) end", conn);1225 1200 } 1226 1201 … … 1231 1206 void tcp_conn_tw_timer_set(tcp_conn_t *conn) 1232 1207 { 1233 log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_conn_tw_timer_set() begin");1234 1208 tcp_conn_addref(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"); 1209 fibril_timer_set(conn->tw_timer, TIME_WAIT_TIMEOUT, tw_timeout_func, 1210 (void *)conn); 1238 1211 } 1239 1212 … … 1244 1217 void tcp_conn_tw_timer_clear(tcp_conn_t *conn) 1245 1218 { 1246 log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_conn_tw_timer_clear() begin"); 1247 if (fibril_timer_clear_locked(conn->tw_timer) == fts_active) 1219 if (fibril_timer_clear(conn->tw_timer) == fts_active) 1248 1220 tcp_conn_delref(conn); 1249 log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_conn_tw_timer_clear() end");1250 1221 } 1251 1222
Note:
See TracChangeset
for help on using the changeset viewer.