#1327 closed Bug (fixed)
Win32 cannot select() on the file descriptors of pipe()
Reported by: | lubomir.marinov | Owned by: | charles |
---|---|---|---|
Priority: | Normal | Milestone: | None Set |
Component: | libtransmission | Version: | 1.34 |
Severity: | Normal | Keywords: | |
Cc: |
Description
The file libtransmission\trevent.c uses a pipe to send commands to the libevent thread. Reading the commands from the pipe from within the libevent thread is performed upon receiving a notification from libevent that the pipe has been written to. Since libevent utilizes select() for the purpose, the effect is that the file descriptors initialized by pipe() are being used with the select() function.
Unfortunately, Win32 select() works with sockets only i.e. pipe() is a no-go because its use causes tr_sessionInitFull to keep on sleeping and checking for h->events after tr_eventInit(h).
A possible solution suggested here has been copied from PostgreSQL (postgresql-8.3.4\src\port\pipe.c) and boils down to using socket() instead of pipe() on Win32.
Attachments (1)
Change History (12)
Changed 13 years ago by lubomir.marinov
comment:1 Changed 13 years ago by charles
- Component changed from Transmission to libtransmission
- Owner set to charles
comment:2 follow-up: ↓ 3 Changed 13 years ago by spry
lubomir.marinov: You're porting transmission to win32?
comment:3 in reply to: ↑ 2 Changed 13 years ago by lubomir.marinov
Replying to spry: I believe Charles has been doing it all along and 99.99% of it is there. I'm interested in a Win32 UI not dependent on wxWidgets or GTK+. So I compiled the CLI of 1.34 and I've been using it for something like a week now (I've been able to compile and user earlier versions as well). Apart from the pipe-select issue, I've disabled the blacklists because of mmap so I'll have to find a solution for it as well and, as I reported in the forum, there's some issue which looks related to large file support. Once these are out of the way, I'll start thinking about beginning the Win32 UI.
comment:4 Changed 13 years ago by spry
Well, I've already finished my C# win32 remote control, 70% already done... I'm really interested in running "daemon" on win32, not for regular use, just to add Transmission to one more platform
comment:5 Changed 13 years ago by spry
Finished C# lib for remote control, UI is 70% done :)
comment:6 Changed 13 years ago by spry
Seems to me that porting daemon, libtransmission and cli on win32 platform is a good idea, and seems to be not a big problem.
comment:7 Changed 13 years ago by spry
So. Maybe we could port libtransmission, daemon, cli and remote to win32? I'd be glad to help. The outlook of my remote control is here http://spry.org.ua/win32remotecontrol.jpg
comment:8 Changed 13 years ago by spry
lubomir.marinov : could you contact me alexey dot pelykh at gmail dot com? I'd like to discuss idea of win32 port of transmission
comment:9 Changed 13 years ago by spry
charles: I've merged the patch provided in winport branch, based on r6882. It works (tested on win32 via MS VS target).
comment:10 Changed 13 years ago by charles
- Resolution set to fixed
- Status changed from new to closed
fixed in r6904.
comment:11 Changed 13 years ago by lubomir.marinov
charles: Thank you!
Provides a pipe() implementation on Win32 which uses socket()