tangled
alpha
login
or
join now
moth11.net
/
rvcx
3
fork
atom
backend for xcvr appview
3
fork
atom
overview
issues
4
pulls
pipelines
make signets for mediainits
moth11.net
5 months ago
94fca2c3
d31649c3
+25
-6
1 changed file
expand all
collapse all
unified
split
server
internal
model
channel.go
+25
-6
server/internal/model/channel.go
···
31
31
logger *log.Logger
32
32
valid bool
33
33
34
34
-
welcome string
35
35
-
server *lrcd.Server
36
36
-
lastID uint32
37
37
-
initChan <-chan lrcpb.Event_Init
38
38
-
ctx context.Context
39
39
-
cancel func()
34
34
+
welcome string
35
35
+
server *lrcd.Server
36
36
+
lastID uint32
37
37
+
initChan <-chan lrcpb.Event_Init
38
38
+
mediainitChan <-chan lrcpb.Event_Mediainit
39
39
+
ctx context.Context
40
40
+
cancel func()
40
41
41
42
clients map[*client]bool
42
43
clientsmu sync.Mutex
···
164
165
var err error
165
166
lastID := cm.lastID
166
167
initChan := make(chan lrcpb.Event_Init, 100)
168
168
+
mediainitChan := make(chan lrcpb.Event_Mediainit, 100)
167
169
168
170
server, err := lrcd.NewServer(
169
171
lrcd.WithWelcome(cm.welcome),
170
172
lrcd.WithLogging(os.Stdout, true),
171
173
lrcd.WithInitialID(lastID),
172
174
lrcd.WithInitChannel(initChan),
175
175
+
lrcd.WithMediainitChannel(mediainitChan),
173
176
lrcd.WithServerURIAndSecret(uri, os.Getenv("LRCD_SECRET")),
174
177
)
175
178
if err != nil {
···
189
192
ctx, cancel := context.WithCancel(context.Background())
190
193
cm.server = server
191
194
cm.initChan = initChan
195
195
+
cm.mediainitChan = mediainitChan
192
196
cm.cancel = cancel
193
197
cm.ctx = ctx
194
198
···
225
229
if !ok {
226
230
cm.logger.Println("this is a weird case!")
227
231
return
232
232
+
}
233
233
+
err := m.rm.PostSignet(e, cm.uri, context.Background())
234
234
+
if err != nil {
235
235
+
m.logger.Println("error posting signet: " + err.Error())
236
236
+
}
237
237
+
case me, ok := <-cm.mediainitChan:
238
238
+
if !ok {
239
239
+
cm.logger.Println("this is a weird case!")
240
240
+
return
241
241
+
}
242
242
+
e := lrcpb.Event_Init{
243
243
+
Init: &lrcpb.Init{
244
244
+
Id: me.Mediainit.Id,
245
245
+
ExternalID: me.Mediainit.ExternalID,
246
246
+
},
228
247
}
229
248
err := m.rm.PostSignet(e, cm.uri, context.Background())
230
249
if err != nil {