|
@@ -41,12 +41,13 @@ const Clrscr = "\x1b[0m\x1b[2J\x1b[H" // Clear screen, home cursor
|
|
|
const HideCursor = "\x1b[?25l" // Hide Cursor
|
|
|
const ShowCursor = "\x1b[?25h" // Show Cursor
|
|
|
var Reset string = Color(0) // ANSI Color Reset
|
|
|
-var Unicode bool // Unicode support detected
|
|
|
-var CP437 bool // CP437 support detected
|
|
|
-var Full_CP437 bool // Full CP437 support detected (handles control codes properly)
|
|
|
-var Height int // Screen height detected
|
|
|
-var Width int // Screen width detected
|
|
|
-var Inactivity int64 = 120 // Inactivity timeout
|
|
|
+
|
|
|
+var Unicode bool // Unicode support detected
|
|
|
+var CP437 bool // CP437 support detected
|
|
|
+var Full_CP437 bool // Full CP437 support detected (handles control codes properly)
|
|
|
+var Height int // Screen height detected
|
|
|
+var Width int // Screen width detected
|
|
|
+var Inactivity int64 = 120 // Inactivity timeout
|
|
|
|
|
|
type MouseInfo struct {
|
|
|
Button int
|
|
@@ -91,15 +92,15 @@ type Door struct {
|
|
|
Config DropfileConfig
|
|
|
READFD int
|
|
|
WRITEFD int
|
|
|
- Disconnected int32 // atomic bool // Has User disconnected/Hung up?
|
|
|
- TimeOut time.Time // Fixed point in time, when time expires
|
|
|
- StartTime time.Time // Time when User started door
|
|
|
- Pushback FIFOBuffer
|
|
|
- LastColor []int // Track the last color sent for restore color
|
|
|
- readerChannel chan byte // Reading from the User
|
|
|
- ReaderCanClose bool // We can close the reader (in tests)
|
|
|
- writerChannel chan string // Writing to the User
|
|
|
- closeChannel chan bool // Closing
|
|
|
+ Disconnected int32 // atomic bool // Has User disconnected/Hung up?
|
|
|
+ TimeOut time.Time // Fixed point in time, when time expires
|
|
|
+ StartTime time.Time // Time when User started door
|
|
|
+ Pushback FIFOBuffer // Key buffer
|
|
|
+ LastColor []int // Track the last color sent for restore color
|
|
|
+ readerChannel chan byte // Reading from the User
|
|
|
+ ReaderCanClose bool // We can close the reader (in tests)
|
|
|
+ writerChannel chan string // Writing to the User
|
|
|
+ closeChannel chan struct{} // Closing
|
|
|
wg sync.WaitGroup
|
|
|
}
|
|
|
|
|
@@ -290,7 +291,7 @@ func (d *Door) Init(doorname string) {
|
|
|
|
|
|
d.readerChannel = make(chan byte, 8)
|
|
|
d.writerChannel = make(chan string)
|
|
|
- d.closeChannel = make(chan bool, 2) // reader & door.Close
|
|
|
+ d.closeChannel = make(chan struct{}, 2) // reader & door.Close
|
|
|
|
|
|
d.setupChannels()
|
|
|
|
|
@@ -314,7 +315,7 @@ func (d *Door) Close() {
|
|
|
}()
|
|
|
|
|
|
log.Println("Closing...")
|
|
|
- d.closeChannel <- true
|
|
|
+ d.closeChannel <- struct{}{}
|
|
|
|
|
|
// CloseReader(d.Config.Comm_handle)
|
|
|
|