Skip to content

Commit

Permalink
separate the rest
Browse files Browse the repository at this point in the history
  • Loading branch information
cooper committed Aug 19, 2015
1 parent ebda81a commit d1aa61a
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 37 deletions.
6 changes: 3 additions & 3 deletions server/agent-connection.go → agent/agent-connection.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package server
package agent

import (
"bufio"
Expand Down Expand Up @@ -65,8 +65,8 @@ func handleAgentEvent(conn *agentConn, data []byte) bool {
}

// if a handler for this command exists, run it
if agentEventHandlers[command] != nil {
agentEventHandlers[command](conn, command, params)
if eventHandlers[command] != nil {
eventHandlers[command](conn, command, params)
}

return true
Expand Down
3 changes: 3 additions & 0 deletions agent/agent-events.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package agent

var eventHandlers = make(map[string]func(conn *agentConn, name string, params map[string]interface{}))
1 change: 1 addition & 0 deletions agent/agent-server.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package agent
2 changes: 1 addition & 1 deletion httpserver/http-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var templates *template.Template
func Run() error {

// initialize templates
templates = template.Must(template.ParseGlob("server/templates/*"))
templates = template.Must(template.ParseGlob("httpserver/templates/*"))

// serve static files in devices directory
// FIXME: this allows access to vnc passwd files
Expand Down
File renamed without changes.
File renamed without changes.
24 changes: 22 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
package main

import "github.com/cooper/screenmgr/server"
import (
_ "github.com/cooper/screenmgr/agent"
"github.com/cooper/screenmgr/device"
"github.com/cooper/screenmgr/httpserver"
_ "github.com/cooper/screenmgr/vnc"
"log"
)

func main() {
server.Run()
checkError("Find devices", device.FindDevices())
checkError("Setup devices", device.SetupDevices())
checkError("Run HTTP server", httpserver.Run())
}

func reportError(action string, err error) {
if err != nil {
log.Println(action, " error: ", err.Error())
}
}

func checkError(action string, err error) {
if err != nil {
log.Fatal(action, " error: ", err.Error())
}
}
3 changes: 0 additions & 3 deletions server/agent-events.go

This file was deleted.

1 change: 0 additions & 1 deletion server/agent-server.go

This file was deleted.

1 change: 0 additions & 1 deletion server/config.go

This file was deleted.

25 changes: 0 additions & 25 deletions server/screenmgr.go

This file was deleted.

File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion server/vnc.go → vnc/vnc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package server
package vnc

// #include "vncauth.h"
import "C"
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit d1aa61a

Please sign in to comment.