Vice Win/SDL fails when using WiC64 chat to send a second chat message.
Analysing the issue shows:
first message:
WiC64: command WIC64_CMD_HTTP_POST_DATA (len=16/0x10, using revised protocol)
WiC64: 0000: 57 4f 52 4b 53 20 46 49 52 53 54 20 54 49 4d 45 |WORKS FIRST TIME|
* Host x.wic64.net:80 was resolved.
* IPv6: (none)
* IPv4: 89.58.51.76
* Trying 89.58.51.76:80...
* Established connection to x.wic64.net (89.58.51.76 port 80) from 192.168.188.5 port 64550
* using HTTP/1.x
> POST /chat/index.php?mac=08d1f909070bpVnWU0acPJMv&f=message HTTP/1.1
Host: x.wic64.net
User-Agent: WiC64/2.1.0 (vice; 3.10)
Accept: */*
Content-Length: 167
Content-Type: multipart/form-data; boundary=------------------------BZibi3Z5GS5fIqsgxAB6TW
* upload completely sent off: 167 bytes
a subsequent message fails:
WiC64: command WIC64_CMD_HTTP_POST_DATA (len=25/0x19, using revised protocol)
WiC64: 0000: 44 4f 45 53 4e 54 20 57 4f 52 4b 20 41 20 53 45 |DOESNT WORK A SE|
WiC64: 0010: 43 4f 4e 44 20 54 49 4d 45 |COND TIME |
* Hostname x.wic64.net was found in DNS cache
* Host x.wic64.net:80 was resolved.
* IPv6: (none)
* IPv4: 89.58.51.76
* failed to open socket: Winsock library not initialized
* connect to port 0 from port 0 failed: No error
* Failed to connect to x.wic64.net:80 after 0 ms: Could not connect to server
* closing connection #1
WiC64: perform failed: Could not connect to server
WiC64: replies Failed to send POST data to server
WiC64: sends header...
WiC64: 0000: 04 00 00 |... |
Probably the code in userport_wic64.c to do the global cleanup here is not correct.
[...]
static void http_get_alarm_handler(CLOCK offset, void *data)
[...]
curl_global_cleanup() // <-- removing this fixes the issue
[...]
A test removing this fixes the issue. Needs to be tested in other ports and if any resources are kept leading to issues far later.
Interesting, that the GTK port on Windows and neither the GTK nor SDL ports on Linux show this issue.
bye, pottendo
very odd. was this actually tested with the exact same VICE revision (preferably github builds)?
Yes, downloaded and reproduced with https://github.com/VICE-Team/svn-mirror/releases, SDL2 windows port; GTK3 windows port from there works.
I seems that the fix is OK; GTK3 windows also works with the fix applied... need to do more tests on linux and see if there's some obvious resource loss...
i'd also check if they use the exact same version of the curl libraries (they should, but you never know)
yes, they're identical.
<unseen2> curl_global_init/curl_global_cleanup have an internal refcount, if it works in one UI but not the other then I would guess that one of them inits curl more often than the other</unseen2>