Skip to content

Commit f18a79f

Browse files
Added yield() to Client and Server
1 parent eff0009 commit f18a79f

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

example_client_hello_world/src/ofApp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ void ofApp::setup(){
99
// OR optionally use SSL
1010
// client.connect("echo.websocket.org", true);
1111

12-
// advanced: set keep-alive timeouts for events like
13-
// loss of internet
14-
1512
// 1 - get default options
1613
// ofxLibwebsockets::ClientOptions options = ofxLibwebsockets::defaultClientOptions();
1714

1815
// 2 - set basic params
1916
// options.host = "echo.websocket.org";
2017

18+
// advanced: set keep-alive timeouts for events like
19+
// loss of internet
20+
2121
// 3 - set keep alive params
2222
// BIG GOTCHA: on BSD systems, e.g. Mac OS X, these time params are system-wide
2323
// ...so ka_time just says "check if alive when you want" instead of "check if

libs/ofxLibwebsockets/src/Client.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ namespace ofxLibwebsockets {
3535
Client::Client(){
3636
context = NULL;
3737
connection = NULL;
38-
waitMillis = 0;
39-
//count_pollfds = 0;
38+
waitMillis = 1;
4039
reactors.push_back(this);
4140

4241
defaultOptions = defaultClientOptions();
@@ -277,6 +276,7 @@ namespace ofxLibwebsockets {
277276
int n = libwebsocket_service(context, waitMillis);
278277
unlock();
279278
}
279+
yield();
280280
} else {
281281
stopThread();
282282
if ( context != NULL ){

libs/ofxLibwebsockets/src/Server.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace ofxLibwebsockets {
3030
//--------------------------------------------------------------
3131
Server::Server(){
3232
context = NULL;
33-
waitMillis = 0;
33+
waitMillis = 1;
3434
reactors.push_back(this);
3535

3636
defaultOptions = defaultServerOptions();
@@ -240,6 +240,7 @@ namespace ofxLibwebsockets {
240240
libwebsocket_service(context, waitMillis);
241241
unlock();
242242
}
243+
yield();
243244
}
244245
}
245246
}

0 commit comments

Comments
 (0)