summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
inline | side by side (from parent 1:
301990c)
Squashed bugs:
* A v1.8+ user that has connected but not agreed will show up in chat and the userlist as a blank user name
* Race condition where a v1.8+ user in connected but not agreed state duplicated the ID of the next user to connect
* A v1.8+ user that is connected but not agreed will receive the user list
Idle bool
AutoReply *[]byte
Transfers map[int][]*FileTransfer
Idle bool
AutoReply *[]byte
Transfers map[int][]*FileTransfer
}
func (cc *ClientConn) sendAll(t int, fields ...Field) {
}
func (cc *ClientConn) sendAll(t int, fields ...Field) {
// NotifyOthers sends transaction t to other clients connected to the server
func (cc ClientConn) NotifyOthers(t Transaction) {
for _, c := range sortedClients(cc.Server.Clients) {
// NotifyOthers sends transaction t to other clients connected to the server
func (cc ClientConn) NotifyOthers(t Transaction) {
for _, c := range sortedClients(cc.Server.Clients) {
+ if c.ID != cc.ID && c.Agreed {
t.clientID = c.ID
cc.Server.outbox <- t
}
t.clientID = c.ID
cc.Server.outbox <- t
}
client := s.Clients[uint16(clientID)]
s.mux.Unlock()
if client == nil {
client := s.Clients[uint16(clientID)]
s.mux.Unlock()
if client == nil {
- return errors.New("invalid client")
+ return fmt.Errorf("invalid client id %v", *t.clientID)
}
userName := string(client.UserName)
login := client.Account.Login
}
userName := string(client.UserName)
login := client.Account.Login
IdleTime: new(int),
AutoReply: &[]byte{},
Transfers: make(map[int][]*FileTransfer),
IdleTime: new(int),
AutoReply: &[]byte{},
Transfers: make(map[int][]*FileTransfer),
}
*s.NextGuestID++
ID := *s.NextGuestID
}
*s.NextGuestID++
ID := *s.NextGuestID
var connectedUsers []Field
for _, c := range sortedClients(s.Clients) {
var connectedUsers []Field
for _, c := range sortedClients(s.Clients) {
+ if c.Agreed == false {
+ continue
+ }
user := User{
ID: *c.ID,
Icon: *c.Icon,
user := User{
ID: *c.ID,
Icon: *c.Icon,
// Show agreement to client
c.Server.outbox <- *NewTransaction(tranShowAgreement, c.ID, NewField(fieldData, s.Agreement))
// Show agreement to client
c.Server.outbox <- *NewTransaction(tranShowAgreement, c.ID, NewField(fieldData, s.Agreement))
- if _, err := c.notifyNewUserHasJoined(); err != nil {
- return err
+ // assume simplified hotline v1.2.3 login flow that does not require agreement
+ if *c.Version == nil {
+ c.Agreed = true
+ if _, err := c.notifyNewUserHasJoined(); err != nil {
+ return err
+ }
c.Server.Stats.LoginCount += 1
const readBuffSize = 1024000 // 1KB - TODO: what should this be?
c.Server.Stats.LoginCount += 1
const readBuffSize = 1024000 // 1KB - TODO: what should this be?
}
func HandleTranAgreed(cc *ClientConn, t *Transaction) (res []Transaction, err error) {
}
func HandleTranAgreed(cc *ClientConn, t *Transaction) (res []Transaction, err error) {
- bs := make([]byte, 2)
- binary.BigEndian.PutUint16(bs, *cc.Server.NextGuestID)
-
cc.UserName = t.GetField(fieldUserName).Data
cc.UserName = t.GetField(fieldUserName).Data
*cc.Icon = t.GetField(fieldUserIconID).Data
options := t.GetField(fieldOptions).Data
*cc.Icon = t.GetField(fieldUserIconID).Data
options := t.GetField(fieldOptions).Data
Icon: &[]byte{0, 2},
Flags: &[]byte{0, 3},
UserName: []byte{0, 4},
Icon: &[]byte{0, 2},
Flags: &[]byte{0, 3},
UserName: []byte{0, 4},
},
uint16(2): {
ID: &[]byte{0, 2},
Icon: &[]byte{0, 2},
Flags: &[]byte{0, 3},
UserName: []byte{0, 4},
},
uint16(2): {
ID: &[]byte{0, 2},
Icon: &[]byte{0, 2},
Flags: &[]byte{0, 3},
UserName: []byte{0, 4},
+ Agreed: true,
+ },
+ uint16(3): {
+ ID: &[]byte{0, 3},
+ Icon: &[]byte{0, 2},
+ Flags: &[]byte{0, 3},
+ UserName: []byte{0, 4},
+ Agreed: false,
t.Errorf("HandleGetUserNameList() error = %v, wantErr %v", err, tt.wantErr)
return
}
t.Errorf("HandleGetUserNameList() error = %v, wantErr %v", err, tt.wantErr)
return
}
- if !reflect.DeepEqual(got, tt.want) {
- t.Errorf("HandleGetUserNameList() got = %v, want %v", got, tt.want)
- }
+ assert.Equal(t, tt.want, got)