Skip to content

Commit

Permalink
remove workaround for creating keys
Browse files Browse the repository at this point in the history
  • Loading branch information
DKingAlpha committed Jan 30, 2020
1 parent 8f69e4d commit 7dca40f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
10 changes: 6 additions & 4 deletions configure/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ package configure

import (
"encoding/json"
"flag"
"io/ioutil"
"log"
"math/rand"
"sync"
"time"
)
var (
roomKeySaveFile = flag.String("keyFile", "room_keys.json", "path to save room keys")
)

const roomKeySaveFile = "room_keys.json"

var RoomKeys = LoadRoomKey(roomKeySaveFile)
var RoomKeys = LoadRoomKey(*roomKeySaveFile)

var roomUpdated = false

Expand All @@ -21,7 +23,7 @@ func init() {
for {
time.Sleep(15 * time.Second)
if roomUpdated {
RoomKeys.Save(roomKeySaveFile)
RoomKeys.Save(*roomKeySaveFile)
roomUpdated = false
}
}
Expand Down
4 changes: 2 additions & 2 deletions protocol/httpopera/http_opera.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (s *Server) Serve(l net.Listener) error {
type stream struct {
Key string `json:"key"`
Url string `json:"url"`
StreamId uint32 `json:"stream_id"`
StreamId uint32 `json:"-"` // hide
VideoTotalBytes uint64 `json:"video_total_bytes"`
VideoSpeed uint64 `json:"video_speed"`
AudioTotalBytes uint64 `json:"audio_total_bytes"`
Expand All @@ -98,7 +98,7 @@ type stream struct {

type streams struct {
Publishers []stream `json:"publishers"`
Players []stream `json:"players"`
Players []stream `json:"-"` // hide
}

//http://127.0.0.1:8090/stat/livestat
Expand Down
1 change: 0 additions & 1 deletion protocol/rtmp/rtmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ func (s *Server) handleConn(conn *core.Conn) error {
flvWriter := new(flv.FlvDvr)
s.handler.HandleWriter(flvWriter.GetWriter(reader.Info()))
} else {
configure.RoomKeys.GetKey(name) // set new key if this channel not exists
writer := NewVirWriter(connServer)
log.Printf("new player: %+v", writer.Info())
s.handler.HandleWriter(writer)
Expand Down

0 comments on commit 7dca40f

Please sign in to comment.