Changeset 061274f in mainline
- Timestamp:
- 2018-06-28T11:09:38Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 82453b29
- Parents:
- 62c4297
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/async/server.c
r62c4297 r061274f 134 134 link_t link; 135 135 136 cap_call_handle_t chandle;137 136 ipc_call_t call; 138 137 } msg_t; … … 165 164 /** Messages that should be delivered to this fibril. */ 166 165 list_t msg_queue; 167 168 /** Identification of the opening call. */169 cap_call_handle_t chandle;170 166 171 167 /** Call data of the opening call. */ … … 413 409 client_t *client = async_client_get(fibril_connection->in_task_id, true); 414 410 if (!client) { 415 ipc_answer_0(fibril_connection->c handle, ENOMEM);411 ipc_answer_0(fibril_connection->call.cap_handle, ENOMEM); 416 412 return 0; 417 413 } … … 422 418 * Call the connection handler function. 423 419 */ 424 fibril_connection->handler(fibril_connection->c handle,420 fibril_connection->handler(fibril_connection->call.cap_handle, 425 421 &fibril_connection->call, fibril_connection->data); 426 422 … … 449 445 450 446 list_remove(&msg->link); 451 ipc_answer_0(msg->c handle, EHANGUP);447 ipc_answer_0(msg->call.cap_handle, EHANGUP); 452 448 free(msg); 453 449 } … … 472 468 * @param in_task_id Identification of the incoming connection. 473 469 * @param in_phone_hash Identification of the incoming connection. 474 * @param chandle Handle of the opening IPC_M_CONNECT_ME_TO call. 475 * If chandle is CAP_NIL, the connection was opened by 476 * accepting the IPC_M_CONNECT_TO_ME call and this 477 * function is called directly by the server. 478 * @param call Call data of the opening call. 470 * @param call Call data of the opening call. If call is NULL, 471 * the connection was opened by accepting the 472 * IPC_M_CONNECT_TO_ME call and this function is 473 * called directly by the server. 479 474 * @param handler Connection handler. 480 475 * @param data Client argument to pass to the connection handler. … … 484 479 */ 485 480 static fid_t async_new_connection(task_id_t in_task_id, sysarg_t in_phone_hash, 486 cap_call_handle_t chandle, ipc_call_t *call, async_port_handler_t handler, 487 void *data) 481 ipc_call_t *call, async_port_handler_t handler, void *data) 488 482 { 489 483 connection_t *conn = malloc(sizeof(*conn)); 490 484 if (!conn) { 491 if (c handle != CAP_NIL)492 ipc_answer_0(c handle, ENOMEM);485 if (call) 486 ipc_answer_0(call->cap_handle, ENOMEM); 493 487 494 488 return (uintptr_t) NULL; … … 498 492 conn->in_phone_hash = in_phone_hash; 499 493 list_initialize(&conn->msg_queue); 500 conn->chandle = chandle;501 494 conn->close_chandle = CAP_NIL; 502 495 conn->handler = handler; … … 505 498 if (call) 506 499 conn->call = *call; 500 else 501 conn->call.cap_handle = CAP_NIL; 507 502 508 503 /* We will activate the fibril ASAP */ … … 513 508 free(conn); 514 509 515 if (c handle != CAP_NIL)516 ipc_answer_0(c handle, ENOMEM);510 if (call) 511 ipc_answer_0(call->cap_handle, ENOMEM); 517 512 518 513 return (uintptr_t) NULL; … … 569 564 sysarg_t phone_hash = IPC_GET_ARG5(answer); 570 565 fid_t fid = async_new_connection(answer.in_task_id, phone_hash, 571 CAP_NIL,NULL, handler, data);566 NULL, handler, data); 572 567 if (fid == (uintptr_t) NULL) 573 568 return ENOMEM; … … 638 633 * timeouts are unregistered. 639 634 * 640 * @param chandle Handle of the incoming call. 641 * @param call Data of the incoming call. 635 * @param call Data of the incoming call. 642 636 * 643 637 * @return False if the call doesn't match any connection. … … 645 639 * 646 640 */ 647 static bool route_call( cap_call_handle_t chandle,ipc_call_t *call)641 static bool route_call(ipc_call_t *call) 648 642 { 649 643 assert(call); … … 668 662 } 669 663 670 msg->chandle = chandle;671 664 msg->call = *call; 672 665 list_append(&msg->link, &conn->msg_queue); 673 666 674 667 if (IPC_GET_IMETHOD(*call) == IPC_M_PHONE_HUNGUP) 675 conn->close_chandle = c handle;668 conn->close_chandle = call->cap_handle; 676 669 677 670 /* If the connection fibril is waiting for an event, activate it */ … … 1042 1035 list_remove(&msg->link); 1043 1036 1044 cap_call_handle_t chandle = msg->c handle;1037 cap_call_handle_t chandle = msg->call.cap_handle; 1045 1038 *call = msg->call; 1046 1039 free(msg); … … 1089 1082 * Otherwise the call is routed to its connection fibril. 1090 1083 * 1091 * @param chandle Handle of the incoming call. 1092 * @param call Data of the incoming call. 1093 * 1094 */ 1095 static void handle_call(cap_call_handle_t chandle, ipc_call_t *call) 1084 * @param call Data of the incoming call. 1085 * 1086 */ 1087 static void handle_call(ipc_call_t *call) 1096 1088 { 1097 1089 assert(call); … … 1100 1092 return; 1101 1093 1102 if (c handle == CAP_NIL) {1094 if (call->cap_handle == CAP_NIL) { 1103 1095 if (call->flags & IPC_CALL_NOTIF) { 1104 1096 /* Kernel notification */ … … 1118 1110 async_get_port_handler(iface, 0, &data); 1119 1111 1120 async_new_connection(call->in_task_id, in_phone_hash, c handle,1121 call,handler, data);1112 async_new_connection(call->in_task_id, in_phone_hash, call, 1113 handler, data); 1122 1114 return; 1123 1115 } 1124 1116 1125 1117 /* Try to route the call through the connection hash table */ 1126 if (route_call(c handle, call))1118 if (route_call(call)) 1127 1119 return; 1128 1120 1129 1121 /* Unknown call from unknown phone - hang it up */ 1130 ipc_answer_0(c handle, EHANGUP);1122 ipc_answer_0(call->cap_handle, EHANGUP); 1131 1123 } 1132 1124 … … 1209 1201 1210 1202 assert(rc == EOK); 1211 handle_call( call.cap_handle,&call);1203 handle_call(&call); 1212 1204 } 1213 1205
Note:
See TracChangeset
for help on using the changeset viewer.