Changeset f303f2cf in mainline
- Timestamp:
- 2014-07-17T08:38:22Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 071a2c60
- Parents:
- 78192cc7
- Location:
- uspace/srv/net
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/ethip/arp.c
r78192cc7 rf303f2cf 119 119 return rc; 120 120 121 (void) atrans_wait_timeout(ARP_REQUEST_TIMEOUT); 122 123 return atrans_lookup(ip_addr, mac_addr); 121 return atrans_lookup_timeout(ip_addr, ARP_REQUEST_TIMEOUT, mac_addr); 124 122 } 125 123 -
uspace/srv/net/ethip/atrans.c
r78192cc7 rf303f2cf 103 103 } 104 104 105 int atrans_lookup(addr32_t ip_addr, addr48_t mac_addr)105 static int atrans_lookup_locked(addr32_t ip_addr, addr48_t mac_addr) 106 106 { 107 fibril_mutex_lock(&atrans_list_lock);108 107 ethip_atrans_t *atrans = atrans_find(ip_addr); 109 if (atrans == NULL) { 110 fibril_mutex_unlock(&atrans_list_lock); 108 if (atrans == NULL) 111 109 return ENOENT; 112 } 113 114 fibril_mutex_unlock(&atrans_list_lock); 110 115 111 addr48(atrans->mac_addr, mac_addr); 116 112 return EOK; 117 113 } 118 114 119 int atrans_ wait_timeout(suseconds_t timeout)115 int atrans_lookup(addr32_t ip_addr, addr48_t mac_addr) 120 116 { 117 int rc; 118 121 119 fibril_mutex_lock(&atrans_list_lock); 122 int rc = fibril_condvar_wait_timeout(&atrans_cv, &atrans_list_lock, 123 timeout); 120 rc = atrans_lookup_locked(ip_addr, mac_addr); 124 121 fibril_mutex_unlock(&atrans_list_lock); 125 122 123 return rc; 124 } 125 126 static void atrans_lookup_timeout_handler(void *arg) 127 { 128 bool *timedout = (bool *)arg; 129 130 fibril_mutex_lock(&atrans_list_lock); 131 *timedout = true; 132 fibril_mutex_unlock(&atrans_list_lock); 133 fibril_condvar_broadcast(&atrans_cv); 134 } 135 136 int atrans_lookup_timeout(addr32_t ip_addr, suseconds_t timeout, 137 addr48_t mac_addr) 138 { 139 fibril_timer_t *t; 140 bool timedout; 141 int rc; 142 143 t = fibril_timer_create(NULL); 144 if (t == NULL) 145 return ENOMEM; 146 147 timedout = false; 148 fibril_timer_set(t, timeout, atrans_lookup_timeout_handler, &timedout); 149 150 fibril_mutex_lock(&atrans_list_lock); 151 152 while ((rc = atrans_lookup_locked(ip_addr, mac_addr)) == ENOENT && 153 !timedout) { 154 fibril_condvar_wait(&atrans_cv, &atrans_list_lock); 155 } 156 157 fibril_mutex_unlock(&atrans_list_lock); 158 (void) fibril_timer_clear(t); 159 126 160 return rc; 127 161 } -
uspace/srv/net/ethip/atrans.h
r78192cc7 rf303f2cf 45 45 extern int atrans_remove(addr32_t); 46 46 extern int atrans_lookup(addr32_t, addr48_t); 47 extern int atrans_ wait_timeout(suseconds_t);47 extern int atrans_lookup_timeout(addr32_t, suseconds_t, addr48_t); 48 48 49 49 #endif -
uspace/srv/net/inetsrv/inet_link.c
r78192cc7 rf303f2cf 465 465 list_foreach(inet_links, link_list, inet_link_t, ilink) { 466 466 id_list[i++] = ilink->svc_id; 467 log_msg(LOG_DEFAULT, LVL_NOTE, "add link to list");468 467 } 469 468 470 469 fibril_mutex_unlock(&inet_links_lock); 471 470 472 log_msg(LOG_DEFAULT, LVL_NOTE, "return %zu links", count);473 471 *rid_list = id_list; 474 472 *rcount = count; -
uspace/srv/net/tcp/tqueue.c
r78192cc7 rf303f2cf 59 59 static void tcp_tqueue_timer_clear(tcp_conn_t *conn); 60 60 61 #include <stdio.h>62 61 int tcp_tqueue_init(tcp_tqueue_t *tqueue, tcp_conn_t *conn) 63 62 { 64 printf("tcp_tqueue_init\n");65 63 tqueue->conn = conn; 66 64 tqueue->timer = fibril_timer_create(&conn->lock); … … 80 78 void tcp_tqueue_fini(tcp_tqueue_t *tqueue) 81 79 { 82 printf("tcp_tqueue_fini\n");83 80 if (tqueue->timer != NULL) { 84 81 fibril_timer_destroy(tqueue->timer);
Note:
See TracChangeset
for help on using the changeset viewer.