Changeset 8cd21d16 in mainline for uspace/lib/c/generic/async_sess.c
- Timestamp:
- 2010-12-26T17:52:18Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4791e3c
- Parents:
- a1dc7fe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/async_sess.c
ra1dc7fe r8cd21d16 107 107 #include <assert.h> 108 108 109 /** An inactive open connection. */ 109 110 typedef struct { 110 link_t conn_link; /**< Link for the list ofconnections. */111 link_t global_link; /**< Link for the global list of phones. */111 link_t sess_link; /**< Link for the session list of inactive connections. */ 112 link_t global_link; /**< Link for the global list of inactive connectinos. */ 112 113 int data_phone; /**< Connected data phone. */ 113 114 } conn_node_t; … … 139 140 } 140 141 142 /** Create a session. 143 * 144 * Session is a logical datapath from a client task to a server task. 145 * One session can accomodate multiple concurrent exchanges. Here 146 * @a phone is a phone connected to the desired server task. 147 * 148 * This function always succeeds. 149 * 150 * @param sess Session structure provided by caller, will be filled in. 151 * @param phone Phone connected to the desired server task. 152 */ 141 153 void async_session_create(async_sess_t *sess, int phone) 142 154 { … … 150 162 } 151 163 164 /** Destroy a session. 165 * 166 * Dismantle session structure @a sess and release any resources (connections) 167 * held by the session. 168 * 169 * @param sess Session to destroy. 170 */ 152 171 void async_session_destroy(async_sess_t *sess) 153 172 { … … 165 184 while (!list_empty(&sess->conn_head)) { 166 185 conn = list_get_instance(sess->conn_head.next, conn_node_t, 167 conn_link);168 169 list_remove(&conn-> conn_link);186 sess_link); 187 188 list_remove(&conn->sess_link); 170 189 list_remove(&conn->global_link); 171 190 … … 177 196 static void conn_node_initialize(conn_node_t *conn) 178 197 { 179 link_initialize(&conn-> conn_link);198 link_initialize(&conn->sess_link); 180 199 link_initialize(&conn->global_link); 181 200 conn->data_phone = -1; … … 200 219 */ 201 220 conn = list_get_instance(sess->conn_head.next, conn_node_t, 202 conn_link);203 list_remove(&conn-> conn_link);221 sess_link); 222 list_remove(&conn->sess_link); 204 223 list_remove(&conn->global_link); 205 224 … … 224 243 conn_node_t, global_link); 225 244 list_remove(&conn->global_link); 226 list_remove(&conn-> conn_link);245 list_remove(&conn->sess_link); 227 246 data_phone = conn->data_phone; 228 247 free(conn); … … 267 286 conn_node_initialize(conn); 268 287 conn->data_phone = data_phone; 269 list_append(&conn-> conn_link, &sess->conn_head);288 list_append(&conn->sess_link, &sess->conn_head); 270 289 list_append(&conn->global_link, &inactive_conn_head); 271 290 fibril_mutex_unlock(&async_sess_mutex);
Note:
See TracChangeset
for help on using the changeset viewer.