Skip to content

Commit ba44c43

Browse files
committed
programs: Group handshake in function
The server handshake in the demo program was in the `make_*_connection` but one function. This patch fixes that for better readability.
1 parent daf370e commit ba44c43

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

programs/server.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
def _make_tls_connection(sock):
2727
assert sock
2828
conn, _addr = sock.accept()
29+
conn.do_handshake()
2930
return conn
3031

3132

@@ -39,6 +40,7 @@ def _make_dtls_connection(sock):
3940
_, (conn, addr) = conn, conn.accept()
4041
_.close()
4142
conn.setcookieparam(addr[0].encode("ascii"))
43+
conn.do_handshake()
4244
return conn
4345

4446

@@ -98,10 +100,6 @@ def run(self, conn_handler):
98100

99101
def _run(self, conn_handler):
100102
with self._make_connection(self._sock) as conn:
101-
try:
102-
conn.do_handshake()
103-
except TLSError:
104-
return
105103
conn_handler(conn)
106104

107105

0 commit comments

Comments
 (0)