Changes in uspace/lib/c/generic/async_sess.c [8b5c8ae:8cd21d16] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/async_sess.c
r8b5c8ae r8cd21d16 110 110 typedef struct { 111 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 connecti ons. */112 link_t global_link; /**< Link for the global list of inactive connectinos. */ 113 113 int data_phone; /**< Connected data phone. */ 114 114 } conn_node_t; 115 115 116 116 /** 117 * Mutex protecting the inactive_conn_head list, the session list and the 118 * avail_phone condition variable. 117 * Mutex protecting the inactive_conn_head list and the session list. 119 118 */ 120 119 static fibril_mutex_t async_sess_mutex; … … 129 128 */ 130 129 static LIST_INITIALIZE(session_list_head); 131 132 /**133 * Condition variable used to wait for a phone to become available.134 */135 static FIBRIL_CONDVAR_INITIALIZE(avail_phone_cv);136 130 137 131 /** Initialize the async_sess subsystem. … … 156 150 * @param sess Session structure provided by caller, will be filled in. 157 151 * @param phone Phone connected to the desired server task. 158 * @param arg1 Value to pass as first argument upon creating a new 159 * connection. Typical use is to identify a resource within 160 * the server that the caller wants to access (port ID, 161 * interface ID, device ID, etc.). 162 */ 163 void async_session_create(async_sess_t *sess, int phone, sysarg_t arg1) 152 */ 153 void async_session_create(async_sess_t *sess, int phone) 164 154 { 165 155 sess->sess_phone = phone; 166 sess->connect_arg1 = arg1;167 156 list_initialize(&sess->conn_head); 168 157 … … 203 192 free(conn); 204 193 } 205 206 fibril_condvar_broadcast(&avail_phone_cv);207 194 } 208 195 … … 244 231 */ 245 232 retry: 246 data_phone = async_connect_me_to(sess->sess_phone, 247 sess->connect_arg1, 0, 0); 233 data_phone = async_connect_me_to(sess->sess_phone, 0, 0, 0); 248 234 if (data_phone >= 0) { 249 235 /* success, do nothing */ … … 264 250 } else { 265 251 /* 266 * Wait for a phone to become available. 252 * This is unfortunate. We failed both to find a cached 253 * connection or to create a new one even after cleaning up 254 * the cache. This is most likely due to too many 255 * open sessions (connected session phones). 267 256 */ 268 fibril_condvar_wait(&avail_phone_cv, &async_sess_mutex); 269 goto retry; 257 data_phone = ELIMIT; 270 258 } 271 259 } … … 285 273 286 274 fibril_mutex_lock(&async_sess_mutex); 287 fibril_condvar_signal(&avail_phone_cv);288 275 conn = (conn_node_t *) malloc(sizeof(conn_node_t)); 289 276 if (!conn) { … … 292 279 * means that we simply hang up. 293 280 */ 281 fibril_mutex_unlock(&async_sess_mutex); 294 282 ipc_hangup(data_phone); 295 fibril_mutex_unlock(&async_sess_mutex);296 283 return; 297 284 }
Note:
See TracChangeset
for help on using the changeset viewer.