]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/server.go
Merge pull request #12 from jhalter/fix_userlist_order
[rbdr/mobius] / hotline / server.go
index 2ee31cf610627dc66956d04f1a1f74852e9315f8..4e2bde2fdfcd613211620efc2980e65ba67fe1a9 100644 (file)
@@ -169,7 +169,7 @@ func (s *Server) Serve(ctx context.Context, cancelRoot context.CancelFunc, ln ne
 }
 
 const (
-       agreementFile    = "Agreement.txt"
+       agreementFile = "Agreement.txt"
 )
 
 // NewServer constructs a new Server from a config dir
@@ -377,7 +377,7 @@ func (s *Server) connectedUsers() []Field {
        defer s.mux.Unlock()
 
        var connectedUsers []Field
-       for _, c := range s.Clients {
+       for _, c := range sortedClients(s.Clients) {
                user := User{
                        ID:    *c.ID,
                        Icon:  *c.Icon,
@@ -413,7 +413,7 @@ func (s *Server) loadAccounts(userDir string) error {
        }
 
        for _, file := range matches {
-               fh, err := os.Open(file)
+               fh, err := FS.Open(file)
                if err != nil {
                        return err
                }
@@ -431,7 +431,7 @@ func (s *Server) loadAccounts(userDir string) error {
 }
 
 func (s *Server) loadConfig(path string) error {
-       fh, err := os.Open(path)
+       fh, err := FS.Open(path)
        if err != nil {
                return err
        }
@@ -830,7 +830,7 @@ func (s *Server) TransferFile(conn net.Conn) error {
                                return err
                        }
 
-                       file, err := os.Open(path)
+                       file, err := FS.Open(path)
                        if err != nil {
                                return err
                        }
@@ -993,7 +993,6 @@ func transferFile(conn net.Conn, dst string) error {
        }
 }
 
-
 // sortedClients is a utility function that takes a map of *ClientConn and returns a sorted slice of the values.
 // The purpose of this is to ensure that the ordering of client connections is deterministic so that test assertions work.
 func sortedClients(unsortedClients map[uint16]*ClientConn) (clients []*ClientConn) {