forked from cwtch.im/cwtch
1
0
Fork 0

Add windows stub for pipeBridge to fix windows build; fix goland error arround ConnectionState[Type]

This commit is contained in:
Dan Ballard 2019-07-26 13:51:29 -07:00
parent 24855ca604
commit 8c16210407
5 changed files with 26 additions and 6 deletions

View File

@ -6,7 +6,6 @@ import (
"cwtch.im/cwtch/storage"
"fmt"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"path"
)

View File

@ -0,0 +1,19 @@
// +build windows
package bridge
import (
"cwtch.im/cwtch/event"
"log"
)
func NewPipeBridgeClient(inFilename, outFilename string) event.IPCBridge {
log.Fatal("Not supported on windows")
return nil
}
// NewPipeBridgeService returns a pipe backed IPCBridge for a service
func NewPipeBridgeService(inFilename, outFilename string) event.IPCBridge {
log.Fatal("Not supported on windows")
return nil
}

View File

@ -1,3 +1,5 @@
// +build !windows
package bridge
import (
@ -5,12 +7,12 @@ import (
"encoding/base64"
"encoding/binary"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"syscall"
"cwtch.im/cwtch/event"
"encoding/json"
"os"
"sync"
"syscall"
)
/* pipeBridge creates a pair of named pipes

View File

@ -189,11 +189,11 @@ func (cp *cwtchPeer) GetProfile() *model.Profile {
}
func (cp *cwtchPeer) GetPeerState(onion string) connections.ConnectionState {
return connections.ConnectionStateType[cp.Profile.Contacts[onion].State]
return connections.ConnectionStateToType[cp.Profile.Contacts[onion].State]
}
func (cp *cwtchPeer) GetGroupState(groupid string) connections.ConnectionState {
return connections.ConnectionStateType[cp.Profile.Groups[groupid].State]
return connections.ConnectionStateToType[cp.Profile.Groups[groupid].State]
}
// PeerWithOnion is the entry point for cwtchPeer relationships

View File

@ -23,7 +23,7 @@ var (
// ConnectionStateName allows conversion of states to their string representations
ConnectionStateName = []string{"Disconnected", "Connecting", "Connected", "Authenticated", "Synced", "Failed", "Killed"}
// ConnectionStateType allows conversion of strings to their state type
ConnectionStateType = map[string]ConnectionState{"Disconnected": DISCONNECTED, "Connecting": CONNECTING,
// ConnectionStateToType allows conversion of strings to their state type
ConnectionStateToType = map[string]ConnectionState{"Disconnected": DISCONNECTED, "Connecting": CONNECTING,
"Connected": CONNECTED, "Authenticated": AUTHENTICATED, "Synced": SYNCED, "Failed": FAILED, "Killed": KILLED}
)