File tree Expand file tree Collapse file tree 7 files changed +25
-6
lines changed Expand file tree Collapse file tree 7 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,9 @@ struct lws_event_loop_ops {
67
67
void (* destroy_wsi )(struct lws * wsi );
68
68
/* return nonzero if caller thread is not loop service thread */
69
69
int (* foreign_thread )(struct lws_context * context , int tsi );
70
+ /* optional: custom implementation for faking POLLIN for buffered.
71
+ * return nonzero if any wsi faked */
72
+ int (* fake_POLLIN_override )(struct lws_context * context , int tsi );
70
73
71
74
uint8_t flags ;
72
75
Original file line number Diff line number Diff line change @@ -491,6 +491,7 @@ static const struct lws_event_loop_ops event_loop_ops_glib = {
491
491
/* destroy_pt */ elops_destroy_pt_glib ,
492
492
/* destroy wsi */ elops_destroy_wsi_glib ,
493
493
/* foreign_thread */ NULL ,
494
+ /* fake_POLLIN */ NULL ,
494
495
495
496
/* flags */ LELOF_DESTROY_FINAL ,
496
497
Original file line number Diff line number Diff line change @@ -443,6 +443,7 @@ static const struct lws_event_loop_ops event_loop_ops_ev = {
443
443
/* destroy_pt */ elops_destroy_pt_ev ,
444
444
/* destroy wsi */ elops_destroy_wsi_ev ,
445
445
/* foreign_thread */ NULL ,
446
+ /* fake_POLLIN */ NULL ,
446
447
447
448
/* flags */ 0 ,
448
449
Original file line number Diff line number Diff line change @@ -495,6 +495,7 @@ static const struct lws_event_loop_ops event_loop_ops_event = {
495
495
/* destroy_pt */ elops_destroy_pt_event ,
496
496
/* destroy wsi */ elops_destroy_wsi_event ,
497
497
/* foreign_thread */ NULL ,
498
+ /* fake_POLLIN */ NULL ,
498
499
499
500
/* flags */ 0 ,
500
501
Original file line number Diff line number Diff line change @@ -926,6 +926,7 @@ static const struct lws_event_loop_ops event_loop_ops_uv = {
926
926
/* destroy_pt */ elops_destroy_pt_uv ,
927
927
/* destroy wsi */ NULL ,
928
928
/* foreign_thread */ elops_foreign_thread_uv ,
929
+ /* fake_POLLIN */ NULL ,
929
930
930
931
/* flags */ 0 ,
931
932
Original file line number Diff line number Diff line change @@ -301,6 +301,7 @@ static const struct lws_event_loop_ops event_loop_ops_uloop = {
301
301
/* destroy_pt */ elops_destroy_pt_uloop ,
302
302
/* destroy wsi */ elops_destroy_wsi_uloop ,
303
303
/* foreign_thread */ NULL ,
304
+ /* fake_POLLIN */ NULL ,
304
305
305
306
/* flags */ 0 ,
306
307
Original file line number Diff line number Diff line change @@ -40,12 +40,23 @@ lws_tls_fake_POLLIN_for_buffered(struct lws_context_per_thread *pt)
40
40
struct lws * wsi = lws_container_of (p , struct lws ,
41
41
tls .dll_pending_tls );
42
42
43
- if (wsi -> position_in_fds_table >= 0 ) {
44
-
45
- pt -> fds [wsi -> position_in_fds_table ].revents = (short )
46
- (pt -> fds [wsi -> position_in_fds_table ].revents |
47
- (pt -> fds [wsi -> position_in_fds_table ].events & LWS_POLLIN ));
48
- ret |= pt -> fds [wsi -> position_in_fds_table ].revents & LWS_POLLIN ;
43
+ /*
44
+ * ... allow custom event loop to override our POLLIN-setting
45
+ * implementation if it knows how to do it better for its case
46
+ */
47
+
48
+ if (pt -> context -> event_loop_ops &&
49
+ pt -> context -> event_loop_ops -> fake_POLLIN_override )
50
+ pt -> context -> event_loop_ops -> fake_POLLIN_override (
51
+ pt -> context , pt -> tid );
52
+ else {
53
+ if (wsi -> position_in_fds_table >= 0 ) {
54
+
55
+ pt -> fds [wsi -> position_in_fds_table ].revents = (short )
56
+ (pt -> fds [wsi -> position_in_fds_table ].revents |
57
+ (pt -> fds [wsi -> position_in_fds_table ].events & LWS_POLLIN ));
58
+ ret |= pt -> fds [wsi -> position_in_fds_table ].revents & LWS_POLLIN ;
59
+ }
49
60
}
50
61
51
62
} lws_end_foreach_dll_safe (p , p1 );
You can’t perform that action at this time.
0 commit comments