Changeset c3f7d37 in mainline for uspace/lib/c/generic/inet/udp.c
- Timestamp:
- 2015-06-07T12:36:44Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 048cd69
- Parents:
- 5a5b087
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/inet/udp.c
r5a5b087 rc3f7d37 36 36 #include <inet/endpoint.h> 37 37 #include <inet/udp.h> 38 #include <io/log.h>39 38 #include <ipc/services.h> 40 39 #include <ipc/udp.h> … … 48 47 async_exch_t *exch = async_exchange_begin(udp->sess); 49 48 50 log_msg(LOG_DEFAULT, LVL_NOTE, "udp_callback_create()");51 52 49 aid_t req = async_send_0(exch, UDP_CALLBACK_CREATE, NULL); 53 50 int rc = async_connect_to_me(exch, 0, 0, 0, udp_cb_conn, udp); … … 68 65 service_id_t udp_svcid; 69 66 int rc; 70 71 log_msg(LOG_DEFAULT, LVL_NOTE, "udp_create()");72 67 73 68 udp = calloc(1, sizeof(udp_t)); … … 122 117 ipc_call_t answer; 123 118 124 log_msg(LOG_DEFAULT, LVL_NOTE, "udp_assoc_create()");125 126 119 assoc = calloc(1, sizeof(udp_assoc_t)); 127 120 if (assoc == NULL) … … 164 157 async_exch_t *exch; 165 158 166 log_msg(LOG_DEFAULT, LVL_NOTE, "udp_assoc_destroy()");167 168 159 if (assoc == NULL) 169 160 return; … … 184 175 async_exch_t *exch; 185 176 186 log_msg(LOG_DEFAULT, LVL_NOTE, "udp_assoc_send_msg()");187 188 177 exch = async_exchange_begin(assoc->udp->sess); 189 178 aid_t req = async_send_1(exch, UDP_ASSOC_SEND_MSG, assoc->id, NULL); … … 228 217 async_exch_t *exch; 229 218 ipc_call_t answer; 230 231 log_msg(LOG_DEFAULT, LVL_NOTE, "udp_rmsg_read()");232 219 233 220 exch = async_exchange_begin(rmsg->udp->sess); … … 237 224 238 225 if (rc != EOK) { 239 log_msg(LOG_DEFAULT, LVL_NOTE, "udp_rmsg_read() - rc != EOK"); 240 async_forget(req); 241 return rc; 242 } 243 244 log_msg(LOG_DEFAULT, LVL_NOTE, "udp_rmsg_read() - wait for req"); 226 async_forget(req); 227 return rc; 228 } 229 245 230 sysarg_t retval; 246 231 async_wait_for(req, &retval); 247 232 if (retval != EOK) { 248 log_msg(LOG_DEFAULT, LVL_NOTE, "udp_rmsg_read() - retval != EOK");249 233 return retval; 250 234 } 251 235 252 log_msg(LOG_DEFAULT, LVL_NOTE, "udp_rmsg_read() - OK");253 236 return EOK; 254 237 } … … 274 257 inet_ep_t ep; 275 258 ipc_call_t answer; 276 277 log_msg(LOG_DEFAULT, LVL_NOTE, "udp_rmsg_info()");278 259 279 260 exch = async_exchange_begin(udp->sess); … … 303 284 async_exch_t *exch; 304 285 305 log_msg(LOG_DEFAULT, LVL_NOTE, "udp_rmsg_discard()");306 307 286 exch = async_exchange_begin(udp->sess); 308 287 sysarg_t rc = async_req_0_0(exch, UDP_RMSG_DISCARD); … … 330 309 int rc; 331 310 332 log_msg(LOG_DEFAULT, LVL_NOTE, "udp_ev_data()");333 334 311 while (true) { 335 312 rc = udp_rmsg_info(udp, &rmsg); 336 313 if (rc != EOK) { 337 log_msg(LOG_DEFAULT, LVL_NOTE, "Error getting message info");338 314 break; 339 315 } … … 341 317 rc = udp_assoc_get(udp, rmsg.assoc_id, &assoc); 342 318 if (rc != EOK) { 343 log_msg(LOG_DEFAULT, LVL_NOTE, "assoc ID %zu not found",344 rmsg.assoc_id);345 319 continue; 346 320 } … … 351 325 rc = udp_rmsg_discard(udp); 352 326 if (rc != EOK) { 353 log_msg(LOG_DEFAULT, LVL_NOTE, "Error discarding message");354 327 break; 355 328 } … … 364 337 365 338 async_answer_0(iid, EOK); 366 367 log_msg(LOG_DEFAULT, LVL_NOTE, "udp_cb_conn()");368 339 369 340 while (true) { … … 371 342 ipc_callid_t callid = async_get_call(&call); 372 343 373 log_msg(LOG_DEFAULT, LVL_NOTE, "udp_cb_conn() - msg %d",374 (int)IPC_GET_IMETHOD(call));375 344 if (!IPC_GET_IMETHOD(call)) { 376 345 /* TODO: Handle hangup */
Note:
See TracChangeset
for help on using the changeset viewer.