-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wake On Access (woa) - 'Just in time' WOL when accessing MySQL or FileShare Server #1892
Conversation
I'm not able to do a pull request to your repo (no clue why - but github doesn't show it as a target repo for pull requests). For getting this to work on osx and ios add this patch (git am ) Seems your repo is a bit messy in general. You shouldn't work in the master branch normally. |
OK, I grabbed the "../network/osx/ioshacks.h" file in your patch, but this is a new and unreferenced file so how will it matter? Was your patch incomplete? |
Ohh yeah - sorry. Somehow i mixed up my patches. You need this one too of course: |
Thanks a lot ! (Hope I got it right) |
I only tested if it recognized/discovered the macs of my sources/mysql server when i enabled the feature in power management. If i got it right this is the only thing which is platform dependend - everything else should work on all platforms right? I'm not able to test wakeup because my server is a arm-based dockstar which doesn't sleep ;) |
Yep you got the commit right - though we need to redo the xcode sync when this PR is merged most likly - but thats no problem ... |
There is also a new ping-function in the network class but I assume it must have compiled as is then .. It just does system("ping ..") and if we are lucky it will work. |
just gave this a try. Working nice in general, but I have some issues with it:
|
|
|
I dont understand what you mean by queuing wol messages? Only scenario where more than 1 wol gets transmitted would be if more than 1 thread accesses server at 'same time' - there is no mutex around the wakeup since worst thing that can happen due to multithreading would be just that ; more than 1 wol is transmitted in a short time-window. The patch will by design NOT prevent server from going to sleep. (If keeping server alive was acceptable behavior then this patch would not be required at all as I see it - keep-alive wols could be done by plug-ins already) |
@@ -204,6 +204,7 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs | |||
|
|||
virtual void Process(); | |||
void ProcessSlow(); | |||
void ProcessSlowEnable(bool enable); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
update;
|
is this one ready for prime time now? If so, please rebase. |
-1 from me for this merge window - i'm not around until monday for this. If @davilla wants to test it for osx/ios then of course this can go in if he made it till close of the merge window. (it needs at least a resync of xcode projects) |
There is still one thing that bothers me with this patch. I've discussed it in the past with t4-ravenbird and he wasn't sure how to "fix" it. For some reason it will wake server when you are accessing Add-ons. I don't think it is a big deal, but I find it odd I have to wait for me server to wake up in order to access Add-ons to watch content from the web. |
@da-anda ready or not, I am not sure to be honest. It seems to work fine for windows-users as far as I have heard, but my own openelec-build is giving me concerns. It works as expected when booting and if xbmc as been idle for a while, but when xbmc resumes from suspend I have some observations I dont like. There appears to be various things that kicks in because of the 'OnWake' event .. and I also for some reason get premature ping-response when resuming. @kricker , that observation should be handled separately IMO. The woa feature just helps to reveal that accessing add-ons for some reason causes db-access (probably) and if that is not a justified behavior than it should be addressed. |
Last update also adds a new 'ping'-function by trying connect on specified port |
Is that last connect osx/ios/android save? |
I merged your original stuff (including proj files) so they might be OK already, can you check it? |
Yes they are ok - i've ment the new connect ping stuff - i will try to test next week (am out of town atm). |
OK, yes I hope it builds on all targets (unless there is some diff in fcntl/sockopt/errno codes?) |
When will this get merged with mainline? |
later than initially. we now have to go to yet another puppy funeral. every time one of you guys write these useless messages, one dies, and we have to attend the funeral. |
Seems I have been chasing a ghost when I had issues with stability ; it all boiled down to a misbehaving server that occasionally responded to ping prematurely. It was an xp-machine, after I upgraded to win7 there is no issues at all. so I combined all my changes into one commit and updated the repo ; it is also rebased |
// process messages which have to be send to the gui | ||
// (this can only be done after g_windowManager.Render()) | ||
CApplicationMessenger::Get().ProcessWindowMessages(); | ||
// only do full processing when m_slowTimer running |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Someone should implement a true ping for nix ... calling system is nothing we want to do for sure! |
true ping would certainly be better but requires root AFAIK so that is why I made it like this. |
So we appeared to have stalled out again on the PR. What can we do to move this forward again? Has Androis and OS X been tested yet? |
I just updated to match latest changes (some settings have been shuffled around a bit that affected this PR) Please have a look and let me know if something should be changed or anything else I can do to make it ready to be merged |
{ | ||
while (!ShouldCancel(0,0)) | ||
{ | ||
if (m_parent->Ping()) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Echoing what @Memphiz said above. Please don't use system() for ping, but implement an actual ping. If root is required, then it will be required to spawn/use the program too, so I'm not following your logic there. This probably won't work on android (if it does, it will be hit or miss), and ping is not guaranteed to exist on embedded systems. Please track down a simple implementation (c/p from busybox should work i'd think) and use it instead. |
@theuni OK, will investigate busybox. Regarding spawning it works since the 'ping' command has some special permissions if i recall correctly |
Some links on ping ; As I understand it ;
I checked my old Android-phone (v 2.3.7) and it has 'ping' utility on it (but phone is rooted and running MIUI so I dont know what its worth) I think using "system("ping")" is the approach with the best chance of getting it to work on most targets ; and if it does not work this patch also adds a "ping by tcp-connect" feature that can be used, check https://github.com/xbmc/xbmc/pull/1892/files#L13R358 |
Updated PR and
My private machines (openelec) are running this and behaving well so far |
The pointer dereference issue made me check again and I realized that after merging with changed handling of settings-files (and inheriting ISettingsHandler) protection is needed for the list of wake-up-servers, so latest commit adds that |
@jmarshallnz Thanks for your input on this PR. After I changed the protection against reentry as discussed above it has run without faults so is looking OK. If you have the time please have a new look and let me know if there is anything more I should look at or if it can be queued for merge? |
@@ -4534,7 +4534,51 @@ msgctxt "#13025" | |||
msgid "Joystick unplugged" | |||
msgstr "" | |||
|
|||
#empty strings from id 13026 to 13049 | |||
msgctxt "#13026" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@MartijnKaijser Done. @garbear I checked other recently added files and they are stamped only 2013 so I stick to that too |
Updated for refactored settings system. |
I noticed that if my NAS didn't wake up in time (and not even in "extra time") and WOL is aborted, I'm not able to play the movie or anything else from that share even after my NAS is finally up. I have to exit and reenter the current view/folder in order to finally play it. Is it related to code of this PR or some temporary flag XBMC core is setting for a file/share? I'm on windows. |
I'm pretty sure that is core XBMC code. Since your server did not wake in time XBMC thinks the item is missing and will not play it. |
I think it is windows networking that flags a share as unavailable for a while after a failed connection attempt. I think you could make a similar observation connecting a share using windows explorer. |
Any chance this can be merged in this window? What is missing or wrong, as far as I know I have resolved all findings that has been pointed out and I am still ready to amend whatever is preventing it from going in |
could you please rebase again @t4-ravenbird ? I try to convice devs to hit the green button :) |
Thanks @t4-ravenbird. @Memphiz or any other mac user - could you please check if it still compiles and is working? |
@da-anda had to go in order to get response from system("ping") edit : i think this is same issue ; http://stackoverflow.com/questions/11084959/system-always-returns-non-zero-when-called-as-cgi |
@t4-ravenbird I unfortunately can't find a OSX tester. I did a test-compile via Jenkins (link in according form topic), so compile seems fine, but function test is missing. We still have a couple of hours, but chances are that it (again) might not make it into this merge window - sorry. |
I'm not a developer, but i got a working macbook and willing to test the pr. Where can i find the compiled binary? |
@da-anda well you have in any case done a great job, maybe now if it misses this window it could be 'staged' to go into next at least? @regnets http://forum.xbmc.org/showthread.php?tid=124340&pid=1417537#pid1417537 |
Wake On Access (woa) - 'Just in time' WOL when accessing MySQL or FileShare Server
@@ -216,7 +216,12 @@ int CPowerManager::BatteryLevel() | |||
} | |||
void CPowerManager::ProcessEvents() | |||
{ | |||
m_instance->PumpPowerEvents(this); | |||
static int nesting = 0; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Forum thread : http://forum.xbmc.org/showthread.php?tid=124340
Replacement for abandoned pull request #1112
Refactored solution based on work by @pieh including simple GUI-setup as discussed in old PR.
Working for Windows (tested by @kricker) and Linux (tested by @bilbonvidia) - but needs verification for other platforms.