@@ -101,14 +101,17 @@ func NewSrtSocket(host string, port uint16, options map[string]string) *SrtSocke
101
101
s .pktSize = defaultPacketSize
102
102
}
103
103
104
- val , s .blocking = options ["blocking" ]
105
- if ! s .blocking || val == "0" {
104
+ val , exists = options ["blocking" ]
105
+ if exists && val != "0" {
106
+ s .blocking = true
107
+ }
108
+ if ! s .blocking {
106
109
s .epollConnect = C .srt_epoll_create ()
107
110
if s .epollConnect < 0 {
108
111
return nil
109
112
}
110
113
var modes C.int
111
- modes = C .SRT_EPOLL_OUT | C .SRT_EPOLL_ERR
114
+ modes = C .SRT_EPOLL_IN | C . SRT_EPOLL_OUT | C .SRT_EPOLL_ERR
112
115
if C .srt_epoll_add_usock (s .epollConnect , s .socket , & modes ) == SRT_ERROR {
113
116
return nil
114
117
}
@@ -193,7 +196,7 @@ func (s SrtSocket) Accept() (*SrtSocket, *net.UDPAddr, error) {
193
196
len := C .int (2 )
194
197
timeoutMs := C .int64_t (- 1 )
195
198
ready := [2 ]C.int {SRT_INVALID_SOCK , SRT_INVALID_SOCK }
196
- if C .srt_epoll_wait (s .epollConnect , nil , nil , & ready [0 ], & len , timeoutMs , nil , nil , nil , nil ) == - 1 {
199
+ if C .srt_epoll_wait (s .epollConnect , & ready [0 ], & len , nil , nil , timeoutMs , nil , nil , nil , nil ) == - 1 {
197
200
return nil , nil , fmt .Errorf ("srt accept, epoll wait issue" )
198
201
}
199
202
}
0 commit comments