Lines Matching refs:peer
31 struct lws_peer *peer) in __lws_peer_remove_from_peer_wait_list() argument
36 if (*p == peer) { in __lws_peer_remove_from_peer_wait_list()
50 struct lws_peer *peer) in __lws_peer_add_to_peer_wait_list() argument
52 __lws_peer_remove_from_peer_wait_list(context, peer); in __lws_peer_add_to_peer_wait_list()
54 peer->peer_wait_list = context->peer_wait_list; in __lws_peer_add_to_peer_wait_list()
55 context->peer_wait_list = peer; in __lws_peer_add_to_peer_wait_list()
66 struct lws_peer *peer; in lws_get_or_create_peer() local
118 peer = lws_zalloc(sizeof(*peer), "peer"); in lws_get_or_create_peer()
119 if (!peer) { in lws_get_or_create_peer()
126 peer->next = context->pl_hash_table[hash]; in lws_get_or_create_peer()
127 peer->hash = hash; in lws_get_or_create_peer()
128 peer->af = af; in lws_get_or_create_peer()
129 context->pl_hash_table[hash] = peer; in lws_get_or_create_peer()
130 memcpy(peer->addr, q, rlen); in lws_get_or_create_peer()
131 time(&peer->time_created); in lws_get_or_create_peer()
136 time(&peer->time_closed_all); in lws_get_or_create_peer()
137 __lws_peer_add_to_peer_wait_list(context, peer); in lws_get_or_create_peer()
141 return peer; in lws_get_or_create_peer()
146 __lws_peer_destroy(struct lws_context *context, struct lws_peer *peer) in __lws_peer_destroy() argument
149 context->pl_hash_table[peer->hash]) { in __lws_peer_destroy()
150 if (*p == peer) { in __lws_peer_destroy()
195 lws_peer_add_wsi(struct lws_context *context, struct lws_peer *peer, in lws_peer_add_wsi() argument
198 if (!peer) in lws_peer_add_wsi()
203 peer->count_wsi++; in lws_peer_add_wsi()
204 wsi->peer = peer; in lws_peer_add_wsi()
205 __lws_peer_remove_from_peer_wait_list(context, peer); in lws_peer_add_wsi()
213 struct lws_peer *peer; in lws_peer_dump_from_wsi() local
215 if (!wsi || !wsi->peer) in lws_peer_dump_from_wsi()
218 peer = wsi->peer; in lws_peer_dump_from_wsi()
223 wsi, (unsigned long long)peer->time_created, in lws_peer_dump_from_wsi()
224 peer->count_wsi, peer->total_wsi, in lws_peer_dump_from_wsi()
225 peer->http.count_ah, peer->http.total_ah); in lws_peer_dump_from_wsi()
228 wsi, (unsigned long long)peer->time_created, in lws_peer_dump_from_wsi()
229 peer->count_wsi, peer->total_wsi); in lws_peer_dump_from_wsi()
234 lws_peer_track_wsi_close(struct lws_context *context, struct lws_peer *peer) in lws_peer_track_wsi_close() argument
236 if (!peer) in lws_peer_track_wsi_close()
241 assert(peer->count_wsi); in lws_peer_track_wsi_close()
242 peer->count_wsi--; in lws_peer_track_wsi_close()
244 if (!peer->count_wsi in lws_peer_track_wsi_close()
246 && !peer->http.count_ah in lws_peer_track_wsi_close()
257 time(&peer->time_closed_all); in lws_peer_track_wsi_close()
258 __lws_peer_add_to_peer_wait_list(context, peer); in lws_peer_track_wsi_close()
267 struct lws_peer *peer) in lws_peer_confirm_ah_attach_ok() argument
269 if (!peer) in lws_peer_confirm_ah_attach_ok()
273 peer->http.count_ah >= context->ip_limit_ah) { in lws_peer_confirm_ah_attach_ok()
284 lws_peer_track_ah_detach(struct lws_context *context, struct lws_peer *peer) in lws_peer_track_ah_detach() argument
286 if (!peer) in lws_peer_track_ah_detach()
290 assert(peer->http.count_ah); in lws_peer_track_ah_detach()
291 peer->http.count_ah--; in lws_peer_track_ah_detach()