Changeset 92b42442 in mainline for uspace/srv/udp/sock.c
- Timestamp:
- 2012-04-05T21:16:00Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7094e196
- Parents:
- ee603c4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/udp/sock.c
ree603c4 r92b42442 114 114 fibril_mutex_initialize(&sock->lock); 115 115 sock->client = client; 116 sock->laddr.ipv4 = UDP_IPV4_ANY;117 116 118 117 rc = udp_uc_create(&sock->assoc); … … 189 188 190 189 fsock.addr.ipv4 = uint32_t_be2host(addr->sin_addr.s_addr); 191 fsock.port = uint16_t_be2host(sock_core->port);190 fsock.port = sock_core->port; 192 191 urc = udp_uc_set_local(socket->assoc, &fsock); 193 192 … … 209 208 } 210 209 210 udp_sock_notify_data(sock_core); 211 211 212 log_msg(LVL_DEBUG, " - success"); 212 213 async_answer_0(callid, rc); … … 286 287 287 288 if (sock_core->port == 0) { 288 /* Implicitly bind socket */289 /* Implicitly bind socket to port */ 289 290 rc = socket_bind(&client->sockets, &gsock, SOCKET_GET_SOCKET_ID(call), 290 291 addr, addr_size, UDP_FREE_PORTS_START, UDP_FREE_PORTS_END, … … 294 295 goto out; 295 296 } 297 298 udp_sock_notify_data(sock_core); 296 299 } 297 300 298 301 socket = (udp_sockdata_t *)sock_core->specific_data; 299 302 fibril_mutex_lock(&socket->lock); 303 304 if (socket->assoc->ident.local.addr.ipv4 == UDP_IPV4_ANY) { 305 /* Determine local IP address */ 306 inet_addr_t loc_addr, rem_addr; 307 308 rem_addr.ipv4 = fsockp ? fsock.addr.ipv4 : 309 socket->assoc->ident.foreign.addr.ipv4; 310 311 rc = inet_get_srcaddr(&rem_addr, 0, &loc_addr); 312 if (rc != EOK) { 313 fibril_mutex_unlock(&socket->lock); 314 async_answer_0(callid, rc); 315 log_msg(LVL_DEBUG, "udp_sock_sendto: Failed to " 316 "determine local address."); 317 return; 318 } 319 320 socket->assoc->ident.local.addr.ipv4 = loc_addr.ipv4; 321 log_msg(LVL_DEBUG, "Local IP address is %x", 322 socket->assoc->ident.local.addr.ipv4); 323 } 324 300 325 301 326 assert(socket->assoc != NULL); … … 394 419 urc = udp_uc_receive(socket->assoc, buffer, FRAGMENT_SIZE, &data_len, 395 420 &xflags, &rsock); 396 log_msg(LVL_DEBUG, "**** udp_uc_receive done ");421 log_msg(LVL_DEBUG, "**** udp_uc_receive done, data_len=%zu", data_len); 397 422 398 423 switch (urc) { … … 459 484 rc = EOVERFLOW; 460 485 486 log_msg(LVL_DEBUG, "read_data_length <- %zu", length); 461 487 SOCKET_SET_READ_DATA_LENGTH(answer, length); 462 answer_call(callid, EOK, &answer, 1); 488 SOCKET_SET_ADDRESS_LENGTH(answer, sizeof(addr)); 489 answer_call(callid, EOK, &answer, 3); 463 490 464 491 /* Push one fragment notification to client's queue */ … … 526 553 527 554 while (true) { 555 log_msg(LVL_DEBUG, "udp_sock_connection: wait"); 528 556 callid = async_get_call(&call); 529 557 if (!IPC_GET_IMETHOD(call)) 530 558 break; 531 559 532 log_msg(LVL_DEBUG, "udp_sock_connection: METHOD=%d \n",560 log_msg(LVL_DEBUG, "udp_sock_connection: METHOD=%d", 533 561 (int)IPC_GET_IMETHOD(call)); 534 562
Note:
See TracChangeset
for help on using the changeset viewer.