Commit bda58b42 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Rename disk to diskwriter.

parent 44ae9f82
package disk package diskwriter
import ( import (
crand "crypto/rand" crand "crypto/rand"
......
...@@ -12,7 +12,7 @@ import ( ...@@ -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 { ...@@ -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 { ...@@ -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)
......
...@@ -15,7 +15,7 @@ import ( ...@@ -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() { ...@@ -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`")
......
...@@ -20,7 +20,7 @@ import ( ...@@ -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) { ...@@ -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) { ...@@ -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),
), ),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment