Change in osmocom-bb[master]: Allow lua code to register a fd for reading with the runtime

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Holger Freyther gerrit-no-reply at lists.osmocom.org
Sun Aug 19 21:25:30 UTC 2018


Hello Jenkins Builder, 

I'd like you to reexamine a change. Please visit

    https://gerrit.osmocom.org/10439

to look at the new patch set (#2).

Change subject: Allow lua code to register a fd for reading with the runtime
......................................................................

Allow lua code to register a fd for reading with the runtime

To have bi-directional communication we can pass credentials to the
registry server and now we can register a callback when the registry
is sending data to us.

The callback needs to return if the fd should continue to be selected
as I found no way to push the userdata as parameter on the stack. Lua
code will look like:

  local host, port = "www.osmocom.org", 80
  local tcp = socket.tcp()
  tcp:connect(host, port);
  tcp:send("GET / HTTP/1.0\r\n\r\n");
  local cb = function()
    local s, status, partial = tcp:receive()
    print(s)
    if status == 'closed' then
     tcp:close()
     return 0
    end
    return 1
  end
  local foo = osmo.register_fd(tcp:getfd(), cb)

Change-Id: I8254bdda1df2f8fe0a5eac894b931e7de5b426df
---
M src/host/layer23/src/mobile/script_lua.c
1 file changed, 103 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/39/10439/2
-- 
To view, visit https://gerrit.osmocom.org/10439
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8254bdda1df2f8fe0a5eac894b931e7de5b426df
Gerrit-Change-Number: 10439
Gerrit-PatchSet: 2
Gerrit-Owner: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180819/e30294eb/attachment.htm>


More information about the gerrit-log mailing list