mirror of https://github.com/Syncplay/syncplay
sendHello only after a successful startTLS handshake, if one is attempted
This commit is contained in:
parent
7b82802f6f
commit
f8ea2381a6
|
@ -757,7 +757,7 @@ class SyncplayClient(object):
|
||||||
|
|
||||||
def connectedNow(f):
|
def connectedNow(f):
|
||||||
hostIP = connectionHandle.result.transport.addr[0]
|
hostIP = connectionHandle.result.transport.addr[0]
|
||||||
self.ui.showMessage(getMessage("handshake-successful-notification").format(host, hostIP))
|
self.ui.showMessage(getMessage("reachout-successful-notification").format(host, hostIP))
|
||||||
return
|
return
|
||||||
|
|
||||||
def failed(f):
|
def failed(f):
|
||||||
|
|
|
@ -16,7 +16,7 @@ de = {
|
||||||
"connection-failed-notification": "Verbindung zum Server fehlgeschlagen",
|
"connection-failed-notification": "Verbindung zum Server fehlgeschlagen",
|
||||||
"connected-successful-notification": "Erfolgreich mit Server verbunden",
|
"connected-successful-notification": "Erfolgreich mit Server verbunden",
|
||||||
"retrying-notification": "%s, versuche erneut in %d Sekunden...", # Seconds
|
"retrying-notification": "%s, versuche erneut in %d Sekunden...", # Seconds
|
||||||
"handshake-successful-notification": "Connection established with {} ({})", # TODO: Translate
|
"reachout-successful-notification": "Successfully reached {} ({})", # TODO: Translate
|
||||||
|
|
||||||
"rewind-notification": "Zurückgespult wegen Zeitdifferenz mit {}", # User
|
"rewind-notification": "Zurückgespult wegen Zeitdifferenz mit {}", # User
|
||||||
"fastforward-notification": "Vorgespult wegen Zeitdifferenz mit {}", # User
|
"fastforward-notification": "Vorgespult wegen Zeitdifferenz mit {}", # User
|
||||||
|
|
|
@ -16,7 +16,7 @@ en = {
|
||||||
"connection-failed-notification": "Connection with server failed",
|
"connection-failed-notification": "Connection with server failed",
|
||||||
"connected-successful-notification": "Successfully connected to server",
|
"connected-successful-notification": "Successfully connected to server",
|
||||||
"retrying-notification": "%s, Retrying in %d seconds...", # Seconds
|
"retrying-notification": "%s, Retrying in %d seconds...", # Seconds
|
||||||
"handshake-successful-notification": "Connection established with {} ({})",
|
"reachout-successful-notification": "Successfully reached {} ({})",
|
||||||
|
|
||||||
"rewind-notification": "Rewinded due to time difference with {}", # User
|
"rewind-notification": "Rewinded due to time difference with {}", # User
|
||||||
"fastforward-notification": "Fast-forwarded due to time difference with {}", # User
|
"fastforward-notification": "Fast-forwarded due to time difference with {}", # User
|
||||||
|
|
|
@ -16,7 +16,7 @@ it = {
|
||||||
"connection-failed-notification": "Connessione col server fallita",
|
"connection-failed-notification": "Connessione col server fallita",
|
||||||
"connected-successful-notification": "Connessione al server effettuata con successo",
|
"connected-successful-notification": "Connessione al server effettuata con successo",
|
||||||
"retrying-notification": "%s, Nuovo tentativo in %d secondi...", # Seconds
|
"retrying-notification": "%s, Nuovo tentativo in %d secondi...", # Seconds
|
||||||
"handshake-successful-notification": "Connessione stabilita con {} ({})",
|
"reachout-successful-notification": "Collegamento stabilito con {} ({})",
|
||||||
|
|
||||||
"rewind-notification": "Riavvolgo a causa della differenza temporale con {}", # User
|
"rewind-notification": "Riavvolgo a causa della differenza temporale con {}", # User
|
||||||
"fastforward-notification": "Avanzamento rapido a causa della differenza temporale con {}", # User
|
"fastforward-notification": "Avanzamento rapido a causa della differenza temporale con {}", # User
|
||||||
|
|
|
@ -16,7 +16,7 @@ ru = {
|
||||||
"connection-failed-notification": "Не удалось подключиться к серверу",
|
"connection-failed-notification": "Не удалось подключиться к серверу",
|
||||||
"connected-successful-notification": "Соединение с сервером установлено",
|
"connected-successful-notification": "Соединение с сервером установлено",
|
||||||
"retrying-notification": "%s, следующая попытка через %d секунд(ы)...", # Seconds
|
"retrying-notification": "%s, следующая попытка через %d секунд(ы)...", # Seconds
|
||||||
"handshake-successful-notification": "Connection established with {} ({})", # TODO: Translate
|
"reachout-successful-notification": "Successfully reached {} ({})", # TODO: Translate
|
||||||
|
|
||||||
"rewind-notification": "Перемотано из-за разницы во времени с {}", # User
|
"rewind-notification": "Перемотано из-за разницы во времени с {}", # User
|
||||||
"fastforward-notification": "Ускорено из-за разницы во времени с {}", # User
|
"fastforward-notification": "Ускорено из-за разницы во времени с {}", # User
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# coding:utf8
|
# coding:utf8
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
from datetime import datetime
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
from twisted.protocols.basic import LineReceiver
|
from twisted.protocols.basic import LineReceiver
|
||||||
|
@ -336,10 +337,9 @@ class SyncClientProtocol(JSONCommandProtocol):
|
||||||
self.transport.startTLS(self._client.protocolFactory.options)
|
self.transport.startTLS(self._client.protocolFactory.options)
|
||||||
elif "false" in answer:
|
elif "false" in answer:
|
||||||
self._client.ui.showErrorMessage(getMessage("startTLS-not-supported-server"))
|
self._client.ui.showErrorMessage(getMessage("startTLS-not-supported-server"))
|
||||||
self.sendHello()
|
self.sendHello()
|
||||||
|
|
||||||
def handshakeCompleted(self):
|
def handshakeCompleted(self):
|
||||||
from datetime import datetime
|
|
||||||
self._serverCertificateTLS = self.transport.getPeerCertificate()
|
self._serverCertificateTLS = self.transport.getPeerCertificate()
|
||||||
self._subjectTLS = self._serverCertificateTLS.get_subject().CN
|
self._subjectTLS = self._serverCertificateTLS.get_subject().CN
|
||||||
self._issuerTLS = self._serverCertificateTLS.get_issuer().CN
|
self._issuerTLS = self._serverCertificateTLS.get_issuer().CN
|
||||||
|
@ -362,6 +362,8 @@ class SyncClientProtocol(JSONCommandProtocol):
|
||||||
'protocolString': self._connVersionStringTLS, 'protocolVersion': self._connVersionNumberTLS,
|
'protocolString': self._connVersionStringTLS, 'protocolVersion': self._connVersionNumberTLS,
|
||||||
'cipher': self._cipherNameTLS})
|
'cipher': self._cipherNameTLS})
|
||||||
|
|
||||||
|
self.sendHello()
|
||||||
|
|
||||||
|
|
||||||
class SyncServerProtocol(JSONCommandProtocol):
|
class SyncServerProtocol(JSONCommandProtocol):
|
||||||
def __init__(self, factory):
|
def __init__(self, factory):
|
||||||
|
|
Loading…
Reference in New Issue