facil-io / cstl

facil.io C STL - a Server Toolbox Library for C, including JSON processing, hash maps, dynamic arrays, binary strings and more.
https://facil.io
MIT License
71 stars 6 forks source link

MingW CI 3 #9

Closed janbiedermann closed 1 year ago

janbiedermann commented 1 year ago

Ok, take this one. Some socket tests still fail. I read somewhere Windows supports UNIX sockets in a way, but probably its a detail how exactly, i need to learn and will fix later on

boazsegev commented 1 year ago

Thank you @janbiedermann for the great input!

Although I adopted pretty much everything, I decided to place the code in the FIO_THREADS module instead of the patches module (I realized it makes better sense to abstract away the differences in a facil.io API rather than risk conflict with the POSIX API). I also reviewed the code and adapted it a little.

As for Unix Sockets:

Since fork doesn't work on Windows, than the Unix Sockets aren't really in use except by user implementations (the pub/sub system doesn't need the socket, so it doesn't open it).

Also, once we do get fork up and running, we have fio_pubsub_ipc_url_set that will allow IPC to use regular sockets instead of Unix Sockets (i.e. tcp://127.0.0.1:9999 might be a safe-ish choice).

Anyway, it seems the current issues with Unix Sockets are actually caused by MinGW (it attempts to rename the socket, placing it at the root folder and breaking something along the way)... The native Windows compiler successfully runs the Unix socket test. (EDIT: cause by a conflict between my code and MinGW's definition of P_tmpdir as \)

I suspect we can find a workaround.

boazsegev commented 1 year ago

Fixed the Unix Socket test on MinGW... seems it was half my bad (MinGW defined P_tmpdir as "\", which conflicted with both Unix style path names and the Unix socket name for the test)... my bad.

It seems to work properly now. The tests aren't done yet, but it passed the sockets test.