1
Fork 0

Rename disk to diskwriter.

This commit is contained in:
Juliusz Chroboczek 2020-10-04 19:01:06 +02:00
parent 44ae9f82d3
commit bda58b42c6
4 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,4 @@
package disk package diskwriter
import ( import (
crand "crypto/rand" crand "crypto/rand"

View File

@ -12,7 +12,7 @@ import (
"github.com/pion/webrtc/v3" "github.com/pion/webrtc/v3"
"sfu/conn" "sfu/conn"
"sfu/disk" "sfu/diskwriter"
"sfu/estimator" "sfu/estimator"
"sfu/group" "sfu/group"
) )
@ -1104,12 +1104,12 @@ func handleClientMessage(c *webClient, m clientMessage) error {
return c.error(group.UserError("not authorised")) return c.error(group.UserError("not authorised"))
} }
for _, cc := range c.group.GetClients(c) { for _, cc := range c.group.GetClients(c) {
_, ok := cc.(*disk.Client) _, ok := cc.(*diskwriter.Client)
if ok { if ok {
return c.error(group.UserError("already recording")) return c.error(group.UserError("already recording"))
} }
} }
disk := disk.New(c.group) disk := diskwriter.New(c.group)
_, err := group.AddClient(c.group.Name(), disk) _, err := group.AddClient(c.group.Name(), disk)
if err != nil { if err != nil {
disk.Close() disk.Close()
@ -1121,7 +1121,7 @@ func handleClientMessage(c *webClient, m clientMessage) error {
return c.error(group.UserError("not authorised")) return c.error(group.UserError("not authorised"))
} }
for _, cc := range c.group.GetClients(c) { for _, cc := range c.group.GetClients(c) {
disk, ok := cc.(*disk.Client) disk, ok := cc.(*diskwriter.Client)
if ok { if ok {
disk.Close() disk.Close()
group.DelClient(disk) group.DelClient(disk)

4
sfu.go
View File

@ -15,7 +15,7 @@ import (
"runtime/pprof" "runtime/pprof"
"syscall" "syscall"
"sfu/disk" "sfu/diskwriter"
"sfu/group" "sfu/group"
"sfu/webserver" "sfu/webserver"
) )
@ -30,7 +30,7 @@ func main() {
"data `directory`") "data `directory`")
flag.StringVar(&group.Directory, "groups", "./groups/", flag.StringVar(&group.Directory, "groups", "./groups/",
"group description `directory`") "group description `directory`")
flag.StringVar(&disk.Directory, "recordings", "./recordings/", flag.StringVar(&diskwriter.Directory, "recordings", "./recordings/",
"recordings `directory`") "recordings `directory`")
flag.StringVar(&cpuprofile, "cpuprofile", "", flag.StringVar(&cpuprofile, "cpuprofile", "",
"store CPU profile in `file`") "store CPU profile in `file`")

View File

@ -20,7 +20,7 @@ import (
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"sfu/disk" "sfu/diskwriter"
"sfu/group" "sfu/group"
"sfu/rtpconn" "sfu/rtpconn"
"sfu/stats" "sfu/stats"
@ -434,7 +434,7 @@ func recordingsHandler(w http.ResponseWriter, r *http.Request) {
p = path.Clean(p) p = path.Clean(p)
f, err := os.Open(filepath.Join(disk.Directory, p)) f, err := os.Open(filepath.Join(diskwriter.Directory, p))
if err != nil { if err != nil {
httpError(w, err) httpError(w, err)
return return
@ -507,7 +507,7 @@ func handleGroupAction(w http.ResponseWriter, r *http.Request, group string) {
return return
} }
err := os.Remove( err := os.Remove(
filepath.Join(disk.Directory, filepath.Join(diskwriter.Directory,
filepath.Join(group, filepath.Join(group,
path.Clean("/"+filename), path.Clean("/"+filename),
), ),