Rev 2492 | Rev 2568 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2492 | Rev 2534 | ||
|---|---|---|---|
| Line 455... | Line 455... | ||
| 455 | * it into the hash table, so that later we can easily do routing of messages to |
455 | * it into the hash table, so that later we can easily do routing of messages to |
| 456 | * particular fibrils. |
456 | * particular fibrils. |
| 457 | * |
457 | * |
| 458 | * @param in_phone_hash Identification of the incoming connection. |
458 | * @param in_phone_hash Identification of the incoming connection. |
| 459 | * @param callid Hash of the opening IPC_M_CONNECT_ME_TO call. |
459 | * @param callid Hash of the opening IPC_M_CONNECT_ME_TO call. |
| - | 460 | * If callid is zero, the connection was opened by |
|
| - | 461 | * accepting the IPC_M_CONNECT_TO_ME call and this function |
|
| - | 462 | * is called directly by the server. |
|
| 460 | * @param call Call data of the opening call. |
463 | * @param call Call data of the opening call. |
| 461 | * @param cfibril Fibril function that should be called upon opening the |
464 | * @param cfibril Fibril function that should be called upon opening the |
| 462 | * connection. |
465 | * connection. |
| 463 | * |
466 | * |
| 464 | * @return New fibril id or NULL on failure. |
467 | * @return New fibril id or NULL on failure. |
| Line 469... | Line 472... | ||
| 469 | connection_t *conn; |
472 | connection_t *conn; |
| 470 | unsigned long key; |
473 | unsigned long key; |
| 471 | 474 | ||
| 472 | conn = malloc(sizeof(*conn)); |
475 | conn = malloc(sizeof(*conn)); |
| 473 | if (!conn) { |
476 | if (!conn) { |
| - | 477 | if (callid) |
|
| 474 | ipc_answer_fast(callid, ENOMEM, 0, 0); |
478 | ipc_answer_fast(callid, ENOMEM, 0, 0); |
| 475 | return NULL; |
479 | return NULL; |
| 476 | } |
480 | } |
| 477 | conn->in_phone_hash = in_phone_hash; |
481 | conn->in_phone_hash = in_phone_hash; |
| 478 | list_initialize(&conn->msg_queue); |
482 | list_initialize(&conn->msg_queue); |
| 479 | conn->callid = callid; |
483 | conn->callid = callid; |
| Line 484... | Line 488... | ||
| 484 | conn->cfibril = cfibril; |
488 | conn->cfibril = cfibril; |
| 485 | 489 | ||
| 486 | conn->wdata.fid = fibril_create(connection_fibril, conn); |
490 | conn->wdata.fid = fibril_create(connection_fibril, conn); |
| 487 | if (!conn->wdata.fid) { |
491 | if (!conn->wdata.fid) { |
| 488 | free(conn); |
492 | free(conn); |
| - | 493 | if (callid) |
|
| 489 | ipc_answer_fast(callid, ENOMEM, 0, 0); |
494 | ipc_answer_fast(callid, ENOMEM, 0, 0); |
| 490 | return NULL; |
495 | return NULL; |
| 491 | } |
496 | } |
| 492 | /* Add connection to the connection hash table */ |
497 | /* Add connection to the connection hash table */ |
| 493 | key = conn->in_phone_hash; |
498 | key = conn->in_phone_hash; |
| 494 | futex_down(&async_futex); |
499 | futex_down(&async_futex); |