1
0
Fork 0
forked from External/ergo

fix various data races, including 2 introduced by #139

This commit is contained in:
Shivaram Lingamneni 2017-10-02 04:42:50 -04:00
parent 58fb997e77
commit 23a66fa502
5 changed files with 82 additions and 43 deletions

View file

@ -94,7 +94,7 @@ func NewClient(server *Server, conn net.Conn, isTLS bool) *Client {
go socket.RunSocketWriter()
client := &Client{
atime: now,
authorized: server.password == nil,
authorized: server.getPassword() == nil,
capabilities: caps.NewSet(),
capState: CapNone,
capVersion: caps.Cap301,
@ -182,10 +182,11 @@ func (client *Client) maxlens() (int, int) {
maxlenTags = 4096
}
if client.capabilities.Has(caps.MaxLine) {
if client.server.limits.LineLen.Tags > maxlenTags {
maxlenTags = client.server.limits.LineLen.Tags
limits := client.server.getLimits()
if limits.LineLen.Tags > maxlenTags {
maxlenTags = limits.LineLen.Tags
}
maxlenRest = client.server.limits.LineLen.Rest
maxlenRest = limits.LineLen.Rest
}
return maxlenTags, maxlenRest
}
@ -679,7 +680,7 @@ func (client *Client) Send(tags *map[string]ircmsg.TagValue, prefix string, comm
func (client *Client) Notice(text string) {
limit := 400
if client.capabilities.Has(caps.MaxLine) {
limit = client.server.limits.LineLen.Rest - 110
limit = client.server.getLimits().LineLen.Rest - 110
}
lines := wordWrap(text, limit)