Removed unused variable

This commit is contained in:
Deluan 2020-12-21 10:01:37 -05:00
parent 14b060a42a
commit 8c063c4f0c

View File

@ -20,14 +20,15 @@ type Broker interface {
SendMessage(event Event) SendMessage(event Event)
} }
var errWriteTimeOut = errors.New("write timeout")
const ( const (
keepAliveFrequency = 15 * time.Second keepAliveFrequency = 15 * time.Second
writeTimeOut = 5 * time.Second writeTimeOut = 5 * time.Second
) )
var eventId uint32 var (
errWriteTimeOut = errors.New("write timeout")
eventId uint32
)
type ( type (
message struct { message struct {
@ -43,7 +44,6 @@ type (
username string username string
userAgent string userAgent string
channel messageChan channel messageChan
done chan struct{}
} }
) )
@ -144,9 +144,6 @@ func (b *broker) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if err == errWriteTimeOut { if err == errWriteTimeOut {
return return
} }
case <-c.done:
log.Trace(ctx, "Closing event stream connection", "client", c.String())
return
case <-ctx.Done(): case <-ctx.Done():
log.Trace(ctx, "Client closed the connection", "client", c.String()) log.Trace(ctx, "Client closed the connection", "client", c.String())
return return
@ -163,7 +160,6 @@ func (b *broker) subscribe(r *http.Request) client {
address: r.RemoteAddr, address: r.RemoteAddr,
userAgent: r.UserAgent(), userAgent: r.UserAgent(),
channel: make(messageChan, 5), channel: make(messageChan, 5),
done: make(chan struct{}, 1),
} }
// Signal the broker that we have a new client // Signal the broker that we have a new client