Changes in uspace/srv/net/udp/assoc.c [89ba88c:498ced1] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/udp/assoc.c
r89ba88c r498ced1 40 40 #include <fibril_synch.h> 41 41 #include <inet/endpoint.h> 42 #include <inet/inet.h> 42 43 #include <io/log.h> 43 44 #include <nettl/amap.h> … … 47 48 #include "msg.h" 48 49 #include "pdu.h" 50 #include "udp_inet.h" 49 51 #include "udp_type.h" 50 52 … … 55 57 static udp_assoc_t *udp_assoc_find_ref(inet_ep2_t *); 56 58 static errno_t udp_assoc_queue_msg(udp_assoc_t *, inet_ep2_t *, udp_msg_t *); 57 static udp_assocs_dep_t *assocs_dep;58 59 59 60 /** Initialize associations. */ 60 errno_t udp_assocs_init( udp_assocs_dep_t *dep)61 errno_t udp_assocs_init(void) 61 62 { 62 63 errno_t rc; … … 68 69 } 69 70 70 assocs_dep = dep;71 71 return EOK; 72 }73 74 /** Finalize associations. */75 void udp_assocs_fini(void)76 {77 assert(list_empty(&assoc_list));78 79 amap_destroy(amap);80 amap = NULL;81 72 } 82 73 … … 183 174 184 175 assert(assoc->deleted == false); 176 udp_assoc_delref(assoc); 185 177 assoc->deleted = true; 186 udp_assoc_delref(assoc);187 178 } 188 179 … … 253 244 errno_t udp_assoc_send(udp_assoc_t *assoc, inet_ep_t *remote, udp_msg_t *msg) 254 245 { 246 udp_pdu_t *pdu; 255 247 inet_ep2_t epp; 256 248 errno_t rc; … … 274 266 if (inet_addr_is_any(&epp.local.addr) && !assoc->nolocal) { 275 267 log_msg(LOG_DEFAULT, LVL_DEBUG, "Determine local address."); 276 rc = (*assocs_dep->get_srcaddr)(&epp.remote.addr, 0, 277 &epp.local.addr); 268 rc = inet_get_srcaddr(&epp.remote.addr, 0, &epp.local.addr); 278 269 if (rc != EOK) { 279 270 log_msg(LOG_DEFAULT, LVL_DEBUG, "Cannot determine " … … 289 280 return EINVAL; 290 281 282 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send - encode pdu"); 283 284 rc = udp_pdu_encode(&epp, msg, &pdu); 285 if (rc != EOK) 286 return ENOMEM; 287 291 288 log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send - transmit"); 292 rc = (*assocs_dep->transmit_msg)(&epp, msg); 289 290 rc = udp_transmit_pdu(pdu); 291 udp_pdu_delete(pdu); 293 292 294 293 if (rc != EOK)
Note:
See TracChangeset
for help on using the changeset viewer.