Skip to content
Snippets Groups Projects
Commit 4b8ee3ed authored by Josh Brooks's avatar Josh Brooks
Browse files

Formatting

parent 29c0229f
No related branches found
No related tags found
2 merge requests!117Release,!77Xx 3563/disable tls check
...@@ -64,10 +64,10 @@ func NewGroupManager(client *Client, requestFunc GroupRequestFunc, ...@@ -64,10 +64,10 @@ func NewGroupManager(client *Client, requestFunc GroupRequestFunc,
// MakeGroup creates a new group and sends a group request to all members in the // MakeGroup creates a new group and sends a group request to all members in the
// group. The ID of the new group, the rounds the requests were sent on, and the // group. The ID of the new group, the rounds the requests were sent on, and the
// status of the send are contained in NewGroupReport. // status of the send are contained in NewGroupReport.
func (g *GroupChat) MakeGroup(membership *IdList, name, message []byte)*NewGroupReport { func (g *GroupChat) MakeGroup(membership *IdList, name, message []byte) *NewGroupReport {
grp, rounds, status, err := g.m.MakeGroup(membership.list, name, message) grp, rounds, status, err := g.m.MakeGroup(membership.list, name, message)
errStr := "" errStr := ""
if err !=nil{ if err != nil {
errStr = err.Error() errStr = err.Error()
} }
return &NewGroupReport{&Group{grp}, rounds, status, errStr} return &NewGroupReport{&Group{grp}, rounds, status, errStr}
...@@ -83,14 +83,14 @@ func (g *GroupChat) ResendRequest(groupIdBytes []byte) (*NewGroupReport, error) ...@@ -83,14 +83,14 @@ func (g *GroupChat) ResendRequest(groupIdBytes []byte) (*NewGroupReport, error)
} }
grp, exists := g.m.GetGroup(groupID) grp, exists := g.m.GetGroup(groupID)
if !exists{ if !exists {
return nil,errors.Errorf("Failed to find group %s", groupID) return nil, errors.Errorf("Failed to find group %s", groupID)
} }
rounds, status, err := g.m.ResendRequest(groupID) rounds, status, err := g.m.ResendRequest(groupID)
errStr := "" errStr := ""
if err !=nil{ if err != nil {
errStr = err.Error() errStr = err.Error()
} }
return &NewGroupReport{&Group{grp}, rounds, status, errStr}, nil return &NewGroupReport{&Group{grp}, rounds, status, errStr}, nil
...@@ -166,11 +166,11 @@ type NewGroupReport struct { ...@@ -166,11 +166,11 @@ type NewGroupReport struct {
group *Group group *Group
rounds []id.Round rounds []id.Round
status gc.RequestStatus status gc.RequestStatus
err string err string
} }
type GroupReportDisk struct { type GroupReportDisk struct {
List []id.Round List []id.Round
GrpId []byte GrpId []byte
Status int Status int
} }
...@@ -201,10 +201,9 @@ func (ngr *NewGroupReport) GetError() string { ...@@ -201,10 +201,9 @@ func (ngr *NewGroupReport) GetError() string {
return ngr.err return ngr.err
} }
func (ngr *NewGroupReport) Marshal() ([]byte, error) { func (ngr *NewGroupReport) Marshal() ([]byte, error) {
grpReportDisk := GroupReportDisk{ grpReportDisk := GroupReportDisk{
List: ngr.rounds, List: ngr.rounds,
GrpId: ngr.group.GetID()[:], GrpId: ngr.group.GetID()[:],
Status: ngr.GetStatus(), Status: ngr.GetStatus(),
} }
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
func Generate(data []byte, t string) []byte { func Generate(data []byte, t string) []byte {
if t==Default{ if t == Default {
return data return data
} }
// Hash fingerprints // Hash fingerprints
......
...@@ -99,10 +99,10 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard, ...@@ -99,10 +99,10 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard,
earliest := uint64(0) earliest := uint64(0)
// create manager object // create manager object
m := manager{ m := manager{
param: params, param: params,
tracker: &tracker, tracker: &tracker,
addrSpace: ephemeral.NewAddressSpace(), addrSpace: ephemeral.NewAddressSpace(),
events: events, events: events,
earliestRound: &earliest, earliestRound: &earliest,
} }
...@@ -258,19 +258,18 @@ func (m *manager) GetVerboseRounds() string { ...@@ -258,19 +258,18 @@ func (m *manager) GetVerboseRounds() string {
return m.verboseRounds.String() return m.verboseRounds.String()
} }
func (m *manager) SetFakeEarliestRound(rnd id.Round) {
func (m *manager) SetFakeEarliestRound(rnd id.Round) {
atomic.StoreUint64(m.earliestRound, uint64(rnd)) atomic.StoreUint64(m.earliestRound, uint64(rnd))
} }
// GetFakeEarliestRound generates a random earliest round for a fake identity. // GetFakeEarliestRound generates a random earliest round for a fake identity.
func (m *manager) GetFakeEarliestRound() id.Round { func (m *manager) GetFakeEarliestRound() id.Round {
b, err := csprng.Generate(8, rand.Reader) b, err := csprng.Generate(8, rand.Reader)
if err != nil { if err != nil {
jww.FATAL.Panicf("Could not get random number: %v", err) jww.FATAL.Panicf("Could not get random number: %v", err)
} }
rangeVal := binary.LittleEndian.Uint64(b) % 800 rangeVal := binary.LittleEndian.Uint64(b) % 800
earliestKnown := atomic.LoadUint64(m.earliestRound) earliestKnown := atomic.LoadUint64(m.earliestRound)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment