Skip to content

Commit

Permalink
examples: Change Unix socket path
Browse files Browse the repository at this point in the history
  • Loading branch information
zjkmxy committed Dec 12, 2023
1 parent efe5cac commit 1ba14f3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/ndn/platform/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ def client_conf_paths(self):
'/etc/ndn/client.conf']

def default_transport(self):
return 'unix:///run/nfd.sock'
if not os.path.exists('/run/nfd/nfd.sock') and os.path.exists('/run/nfd.sock'):
# Try to be compatible to old NFD
return 'unix:///run/nfd.sock'
return 'unix:///run/nfd/nfd.sock'

def default_pib_scheme(self):
return 'pib-sqlite3'
Expand Down
5 changes: 4 additions & 1 deletion src/ndn/platform/osx.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ def client_conf_paths(self):
'/etc/ndn/client.conf']

def default_transport(self):
return 'unix:///var/run/nfd.sock'
if not os.path.exists('/var/run/nfd/nfd.sock') and os.path.exists('/var/run/nfd.sock'):
# Try to be compatible to old NFD
return 'unix:///var/run/nfd.sock'
return 'unix:///var/run/nfd/nfd.sock'

def default_pib_scheme(self):
return 'pib-sqlite3'
Expand Down
13 changes: 10 additions & 3 deletions src/ndn/platform/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ class Cng:
NCRYPT_ECDSA_P521_ALGORITHM = BCRYPT_ECDSA_P521_ALGORITHM
BCRYPT_OBJECT_LENGTH = c.c_wchar_p('ObjectLength')
BCRYPT_HASH_LENGTH = c.c_wchar_p('HashDigestLength')
MS_PLATFORM_KEY_STORAGE_PROVIDER = c.c_wchar_p('Microsoft Platform Crypto Provider')
MS_KEY_STORAGE_PROVIDER = c.c_wchar_p('Microsoft Software Key Storage Provider')
MS_PLATFORM_KEY_STORAGE_PROVIDER = c.c_wchar_p(
'Microsoft Platform Crypto Provider')
MS_KEY_STORAGE_PROVIDER = c.c_wchar_p(
'Microsoft Software Key Storage Provider')
BCRYPT_ECCPUBLIC_BLOB = c.c_wchar_p('ECCPUBLICBLOB')
BCRYPT_ECCPRIVATE_BLOB = c.c_wchar_p('ECCPRIVATEBLOB')

Expand Down Expand Up @@ -79,7 +81,12 @@ def client_conf_paths(self):

def default_transport(self):
# Note: %TEMP% won't be redirected even when the executable is a MSIX/MicrosoftStore app
return 'unix://' + os.path.expandvars(r'%TEMP%\nfd.sock')
oldPath = os.path.expandvars(r'%TEMP%\nfd.sock')
newPath = os.path.expandvars(r'%TEMP%\nfd\nfd.sock')
if not os.path.exists(newPath) and os.path.exists(oldPath):
# Try to be compatible to old NFD
return 'unix://' + oldPath
return 'unix://' + newPath

def default_pib_scheme(self):
return 'pib-sqlite3'
Expand Down

0 comments on commit 1ba14f3

Please sign in to comment.