fix deadlock fr; just needed to make the outgoing channel buffered lmao
This commit is contained in:
parent
f1f6265f6d
commit
61b2f6345b
2 changed files with 7 additions and 10 deletions
|
|
@ -56,18 +56,15 @@ func (app *App) Last(n int) (err error) {
|
|||
return err
|
||||
}
|
||||
|
||||
if nsrv == 0 {
|
||||
goto count
|
||||
}
|
||||
|
||||
if nsrv != 0 {
|
||||
for range nsrv {
|
||||
if !app.scanner.Scan() {
|
||||
return app.scanner.Err()
|
||||
}
|
||||
app.incoming <- Message(app.scanner.Text())
|
||||
}
|
||||
}
|
||||
|
||||
count:
|
||||
var last int
|
||||
if !app.scanner.Scan() {
|
||||
return app.scanner.Err()
|
||||
|
|
|
|||
2
main.go
2
main.go
|
|
@ -82,7 +82,7 @@ func (app *App) Connect(host, port string) (err error) {
|
|||
}
|
||||
app.scanner = bufio.NewScanner(app.conn)
|
||||
app.incoming = make(chan IncomingEvent)
|
||||
app.outgoing = make(chan OutgoingEvent)
|
||||
app.outgoing = make(chan OutgoingEvent, 256)
|
||||
app.error = make(chan error)
|
||||
app.ticker = time.NewTicker(1 * time.Second)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue