Skip to content

Commit 4015cc3

Browse files
Merge branch 'fix_idle_times'
Conflicts: README.md
2 parents b270a85 + 1751499 commit 4015cc3

File tree

6 files changed

+22
-45
lines changed

6 files changed

+22
-45
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
NOV132014 (Version 0.3.3):
2+
Improved CPU Usage - More battery power for all.
3+
Added basic chat client/server example.
4+
15
NOV132014 (Version 0.3.2):
26

37
Important Changes:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
go-thrust
22
=========
3-
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/miketheprogrammer/go-thrust?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4-
Current Go-Thrust Version 0.3.2
3+
Current Go-Thrust Version 0.3.3
54
Current Thrust Version 0.7.5
65

76
![Logo Thrust](http://i.imgur.com/DwFKI0J.png)
@@ -11,6 +10,7 @@ Chat with us
1110
==================
1211
irc: #breach on freenode - this is the entire breach/thrust community
1312
gitter.im : https://gitter.im/miketheprogrammer/go-thrust - focused on go-thrust.
13+
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/miketheprogrammer/go-thrust?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1414

1515

1616
Quick Start, see it in action

common/versions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ package common
22

33
const (
44
THRUST_VERSION = "0.7.5"
5-
THRUST_GO_VERSION = "0.3.2"
5+
THRUST_GO_VERSION = "0.3.3"
66
)

connection/connection.go

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import (
55
"encoding/json"
66
"fmt"
77
"io"
8-
"os"
98
"strings"
10-
"time"
119

1210
"github.com/miketheprogrammer/go-thrust/commands"
1311
. "github.com/miketheprogrammer/go-thrust/common"
@@ -70,42 +68,28 @@ func GetCommunicationChannels() (*Out, *In) {
7068

7169
func Reader(out *Out, in *In) {
7270

73-
r := bufio.NewReader(Stdout)
71+
reader := bufio.NewReader(Stdout)
7472
defer Stdin.Close()
7573
for {
76-
select {
77-
case quit := <-in.Quit:
78-
Log.Errorf("Connection Reader Received a Quit message from somewhere ... Exiting Now")
79-
os.Exit(quit)
80-
default:
81-
//a := <-in.Quit
82-
//fmt.Println(a)
83-
line, err := r.ReadString(byte('\n'))
84-
if err != nil {
85-
fmt.Println(err)
86-
panic(err)
87-
}
88-
89-
Log.Debug("SOCKET::Line", line)
90-
if !strings.Contains(line, SOCKET_BOUNDARY) {
91-
response := commands.CommandResponse{}
92-
json.Unmarshal([]byte(line), &response)
93-
//Log.Debug(response)
94-
out.CommandResponses <- response
95-
}
96-
74+
line, err := reader.ReadString(byte('\n'))
75+
if err != nil {
76+
fmt.Println(err)
77+
panic(err)
9778
}
98-
time.Sleep(time.Microsecond * 100)
9979

80+
Log.Debug("SOCKET::Line", line)
81+
if !strings.Contains(line, SOCKET_BOUNDARY) {
82+
response := commands.CommandResponse{}
83+
json.Unmarshal([]byte(line), &response)
84+
out.CommandResponses <- response
85+
}
10086
}
101-
10287
}
10388

10489
func Writer(out *Out, in *In) {
10590
for {
10691
select {
10792
case response := <-in.CommandResponses:
108-
Log.Info("CommandResponse Marhshaling.")
10993
cmd, _ := json.Marshal(response)
11094
Log.Debug("Writing RESPONSE", string(cmd), "\n", SOCKET_BOUNDARY)
11195

@@ -126,7 +110,5 @@ func Writer(out *Out, in *In) {
126110
Stdin.Write([]byte(SOCKET_BOUNDARY))
127111
Stdin.Write([]byte("\n"))
128112
}
129-
130-
time.Sleep(time.Microsecond * 100)
131113
}
132114
}

dispatcher/dispatcher.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package dispatcher
22

33
import (
4-
"time"
5-
64
"github.com/miketheprogrammer/go-thrust/commands"
75
"github.com/miketheprogrammer/go-thrust/connection"
86
)
@@ -34,22 +32,16 @@ need this loop to be the blocking loop.
3432
For Instance, in a HTTP Server setting, you might want to run this as a
3533
goroutine and then let the servers blocking handler keep the process open.
3634
As long as there are commands in the channel, this loop will dispatch as fast
37-
as possible, when all commands are exhausted this loop will run on iterations
38-
of 10 microseconds optimistically.
35+
as possible
3936
*/
4037
func RunLoop() {
4138
outChannels := connection.GetOutputChannels()
4239
for {
4340
Run(outChannels)
44-
time.Sleep(time.Microsecond * 10)
4541
}
4642
}
4743

4844
func Run(outChannels *connection.Out) {
49-
select {
50-
case response := <-outChannels.CommandResponses:
51-
Dispatch(response)
52-
default:
53-
break
54-
}
45+
response := <-outChannels.CommandResponses
46+
Dispatch(response)
5547
}

menu/menu.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ func (menu *Menu) SendThread() {
224224
if menu.IsTreeStable() {
225225
menu.Sync.TreeStableChan <- true
226226
}
227-
time.Sleep(time.Microsecond * 10)
227+
time.Sleep(time.Microsecond * 100)
228228
}
229229
}()
230230

@@ -272,7 +272,6 @@ func (menu *Menu) SendThread() {
272272
menu.Sync.TreeStableQueue = CremoveItemAt(menu.Sync.TreeStableQueue, 0)
273273
menu.Call(command)
274274
}
275-
time.Sleep(time.Microsecond * 10)
276275
}
277276
}()
278277
}

0 commit comments

Comments
 (0)