Nir Soffer has posted comments on this change.

Change subject: utils: add a utility to create a socket
......................................................................


Patch Set 1:

(2 comments)

utils is not the place for this. Try to find a more focused module - maybe 
sslutils?

https://gerrit.ovirt.org/#/c/41893/1/lib/vdsm/utils.py
File lib/vdsm/utils.py:

Line 1286:     return count * size
Line 1287: 
Line 1288: 
Line 1289: def create_socket(host, port, sslctx=None, timeout=None):
Line 1290:     sock = None
No need to initialize sock with None. sock will be created by on of the code 
paths in the following if.

If someone modify the code, changing the behavior so sock is not always 
created, a NameError would be easier to debug than AttributeError, when 
accessing sock.settimeout().
Line 1291:     if sslctx:
Line 1292:         sock = SSL.Connection(sslctx.context)
Line 1293:     else:
Line 1294:         sock = socket.socket(socket.AF_INET,


Line 1293:     else:
Line 1294:         sock = socket.socket(socket.AF_INET,
Line 1295:                              socket.SOCK_STREAM)
Line 1296:     sock.settimeout(timeout)
Line 1297:     sock.connect((host, port))
A better name would be create_connection - this is mostly like 
socket.create_connection with ssl support.


-- 
To view, visit https://gerrit.ovirt.org/41893
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib66bf3c1d292cd25bb91ea2bf36c641ab6f68310
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <[email protected]>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <[email protected]>
Gerrit-Reviewer: Piotr Kliczewski <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to