forked from Elara6331/itd
Start separate goroutine for multiplexed stream handling
This commit is contained in:
parent
b656c69350
commit
94ec82c4a6
18
socket.go
18
socket.go
@ -94,14 +94,18 @@ func startSocket(ctx context.Context, dev *infinitime.Device) error {
|
||||
log.Fatal().Err(err).Msg("Error creating multiplexed session")
|
||||
}
|
||||
|
||||
for {
|
||||
conn, err := sess.Accept()
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Error accepting stream")
|
||||
}
|
||||
go func() {
|
||||
for {
|
||||
conn, err := sess.Accept()
|
||||
if errors.Is(err, io.EOF) {
|
||||
break
|
||||
} else if err != nil {
|
||||
log.Fatal().Err(err).Msg("Error accepting stream")
|
||||
}
|
||||
|
||||
go srv.ServeOne(ctx, conn)
|
||||
}
|
||||
go srv.ServeOne(ctx, conn)
|
||||
}
|
||||
}()
|
||||
}
|
||||
}()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user