Scripting: Return status from socket.connect, fix coding style

This commit is contained in:
Adam Higerd 2022-09-25 18:57:03 -05:00 committed by Vicki Pfau
parent 7520d8fc06
commit b60e0b9282
2 changed files with 2 additions and 1 deletions

View File

@ -83,7 +83,7 @@ server = nil
while not server do
server, err = socket.bind(nil, port)
if err then
if err == "address in use" then
if err == socket.ERRORS.ADDRESS_IN_USE then
port = port + 1
else
console:error(ST_format("Bind", err, true))

View File

@ -126,6 +126,7 @@ static const char* _socketLuaSource =
" end,\n"
" connect = function(self, address, port)\n"
" local status = self._s:connect(address, port)\n"
" return socket._wrap(status)\n"
" end,\n"
" listen = function(self, backlog)\n"
" local status = self._s:listen(backlog or 1)\n"