Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Porting to mbed

SaeHie Park edited this page Dec 11, 2015 · 6 revisions

While making libtuv run on mbed, these are the tweaks that I am trying, not knowing much about mbed...

High resolution time

Timer runs in nano seconds but overflows in about 30 minutes. Try use accumulation value of timer every uv__hrtime call.

Pipe

hum...

poll()

file descriptor? mbed don't have this

  • emulate with object index.
  • can have problems. fix when it happens.

for network, onreadble, onsent and ondisconnect callback.

shutdown ?

Call stack when client is force disconnected in linux.

uv_shutdown() at uv_unix_stream.c:959 0x8074f68	
after_read() at echo_server.c:102 0x8064bdf	
uv__stream_eof() at uv_unix_stream.c:434 0x8073e6b	
uv__read() at uv_unix_stream.c:911 0x8074d62	
uv__stream_io() at uv_unix_stream.c:503 0x8074030	
uv__io_poll() at uv_linux_io.c:236 0x8076c42	
uv_run() at uv_run.c:167 0x806c538	

and then for io watcher

after_shutdown() at echo_server.c:81 0x8064997	
uv__drain() at uv_unix_stream.c:412 0x8073d22	
uv__stream_io() at uv_unix_stream.c:531 0x80740df	
uv__io_poll() at uv_linux_io.c:236 0x8076c42	
uv_run() at uv_run.c:167 0x806c538	
connect()
  • mbed socket connect is async. uv handles EINPROGRESS as not a problem, so return -1 with EINPROGRESS
  • connection starts at uv__tcp_connect()
  • this is monitored with io with uv__tcp_connect
  • when poll detects connection, uv__stream_connect() is called through uv__stream_io()
  • connection state is checked with tuvp_getsockopt() so, must implement SOL_SOCKET + SO_ERROR
Clone this wiki locally