Perform Basic Server Checks #110
|
@ -354,7 +354,7 @@ func main() {
|
|||
app.Peer.JoinServer(group.GroupServer)
|
||||
}
|
||||
} else {
|
||||
fmt.Printf("Error creating new group: %v", err)
|
||||
fmt.Printf("Error creating new group: %v\n", err)
|
||||
}
|
||||
} else {
|
||||
fmt.Printf("Error creating a new group, usage: %s\n", usages["new-group"])
|
||||
|
|
|
@ -25,6 +25,7 @@ import (
|
|||
"log"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// cwtchPeer manages incoming and outgoing connections and all processing for a Cwtch Peer
|
||||
|
@ -235,7 +236,21 @@ func (cp *cwtchPeer) ExportGroup(groupID string) (string, error) {
|
|||
|
||||
// StartGroup create a new group linked to the given server and returns the group ID, an invite or an error.
|
||||
func (cp *cwtchPeer) StartGroup(server string) (string, []byte, error) {
|
||||
if len(server) == 16 {
|
||||
servers := cp.GetServers()
|
||||
_, ok := servers[server]
|
||||
if !ok {
|
||||
cp.JoinServer(server)
|
||||
time.Sleep(5 * time.Second)
|
||||
servers = cp.GetServers()
|
||||
}
|
||||
status, ok := servers[server]
|
||||
if status != connections.AUTHENTICATED {
|
||||
return "", nil, errors.New("server could not be connected, please check to see if this server is a cwtch server")
|
||||
}
|
||||
return cp.Profile.StartGroup(server)
|
||||
}
|
||||
return "", nil, errors.New("server is not an onion address")
|
||||
}
|
||||
|
||||
// GetGroups returns an unordered list of all group IDs.
|
||||
|
|
Loading…
Reference in New Issue