~kris/9p

glenda

ref: 2e156f53f7feae892a718d97d1c28ac967be109e glenda/misc.go -rw-r--r-- 456 bytes
2e156f53 — Sean Hinchee cleaning 8 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main

// Miscellaneous utilities for communicating with Mux

import (
	"bitbucket.org/henesy/glenda/x/mux"
	"time"
)

// Service for communicating with Mux (starts once)
func CommMux() {
	for {
		select {
		case r := <-mux.GlendaChan:
			if r == "dump" {
				err := Config.Write()
				if err != nil {
					mux.MuxChan <- "dump failed"
				} else {
					mux.MuxChan <- "dump ok"
				}
			}
		default:
		}

		time.Sleep(500 * time.Millisecond)
	}
}