Giter Club home page Giter Club logo

Comments (7)

brunoos avatar brunoos commented on July 24, 2024

Could you tell me the parameters of SSL_set_fd() on win64? (ssl.h)
I think we have another problem...

from luasec.

Petr-kk avatar Petr-kk commented on July 24, 2024

I think so, but not very urgent.

Same as in win32: SSL_set_fd(SSL *s, int fd) but int is 64-bit.

I think that normal fd fits into lua number, but invalidfd in win64 not.
I have two ideas how to fix it:

  1. clean solution - reimplement fd as light userdata
  2. fast dirty - remove invalidfd constant and add two methods isvalidfd and invalidatefd

from luasec.

brunoos avatar brunoos commented on July 24, 2024

Sorry, but I think "int" is not 64 bits on win64.

from luasec.

Petr-kk avatar Petr-kk commented on July 24, 2024

You are right, my mistake - int is 32bit
But in win64 SOCKET and INVALID_SOCKET size is 64bit (UINT_PTR)

from luasec.

Petr-kk avatar Petr-kk commented on July 24, 2024

I temporary solve the problem this way:

--- a/src/ssl.lua
+++ b/src/ssl.lua
@@ -126,7 +126,8 @@ function wrap(sock, cfg)
local s, msg = core.create(ctx)
if s then
core.setfd(s, sock:getfd())

  •  sock:setfd(core.invalidfd)
    
  •  --sock:setfd(core.invalidfd)
    
  •  sock:setfd(-1)
    
    registry[s] = ctx
    return s
    end

Works for me in linux32/64 and win32/64, lua 5.1 and 5.2

from luasec.

brunoos avatar brunoos commented on July 24, 2024

It seems that LuaSocket transforms -1 into INVALID_SOCKET.

Other libraries, like luaevent, use the descriptor directly. Luckily (or not), when we cast (-1) to uint32 or uint64 we have UINT32_MAX (UINT64_MAX), that is INVALID_SOCKET on win32/64.

from luasec.

brunoos avatar brunoos commented on July 24, 2024

Note: if Windows returns big numbers for socket, we still have problem due to double representation. Integer numbers of Lua 5.3 can help us...

from luasec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.