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,
// 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
// 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)
errStr := ""
if err !=nil{
if err != nil {
errStr = err.Error()
}
return &NewGroupReport{&Group{grp}, rounds, status, errStr}
......@@ -83,14 +83,14 @@ func (g *GroupChat) ResendRequest(groupIdBytes []byte) (*NewGroupReport, error)
}
grp, exists := g.m.GetGroup(groupID)
if !exists{
return nil,errors.Errorf("Failed to find group %s", groupID)
if !exists {
return nil, errors.Errorf("Failed to find group %s", groupID)
}
rounds, status, err := g.m.ResendRequest(groupID)
errStr := ""
if err !=nil{
if err != nil {
errStr = err.Error()
}
return &NewGroupReport{&Group{grp}, rounds, status, errStr}, nil
......@@ -166,11 +166,11 @@ type NewGroupReport struct {
group *Group
rounds []id.Round
status gc.RequestStatus
err string
err string
}
type GroupReportDisk struct {
List []id.Round
List []id.Round
GrpId []byte
Status int
}
......@@ -201,10 +201,9 @@ func (ngr *NewGroupReport) GetError() string {
return ngr.err
}
func (ngr *NewGroupReport) Marshal() ([]byte, error) {
grpReportDisk := GroupReportDisk{
List: ngr.rounds,
List: ngr.rounds,
GrpId: ngr.group.GetID()[:],
Status: ngr.GetStatus(),
}
......
......@@ -7,7 +7,7 @@ import (
func Generate(data []byte, t string) []byte {
if t==Default{
if t == Default {
return data
}
// Hash fingerprints
......
......@@ -99,10 +99,10 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard,
earliest := uint64(0)
// create manager object
m := manager{
param: params,
tracker: &tracker,
addrSpace: ephemeral.NewAddressSpace(),
events: events,
param: params,
tracker: &tracker,
addrSpace: ephemeral.NewAddressSpace(),
events: events,
earliestRound: &earliest,
}
......@@ -258,19 +258,18 @@ func (m *manager) GetVerboseRounds() 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))
}
// 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)
if err != nil {
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)
......
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