X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fjsonrpc.c;h=f42035e80f5884e7cf25aeca0a730dea391f4c27;hb=4c4d10b13fc01f6d785dc35dc2f789dab9c8ced9;hp=0f535155ea62ff74039bb8a8b12f0e3c427c7567;hpb=4931f33ad9e25eb2df70ff20f1eeb4df813f8b2c;p=openvswitch diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c index 0f535155..f42035e8 100644 --- a/lib/jsonrpc.c +++ b/lib/jsonrpc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nicira Networks. + * Copyright (c) 2009, 2010 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ #include "jsonrpc.h" +#include #include #include "byteq.h" @@ -88,6 +89,7 @@ jsonrpc_run(struct jsonrpc *rpc) return; } + stream_run(rpc->stream); while (!queue_is_empty(&rpc->output)) { struct ofpbuf *buf = rpc->output.head; int retval; @@ -113,8 +115,11 @@ jsonrpc_run(struct jsonrpc *rpc) void jsonrpc_wait(struct jsonrpc *rpc) { - if (!rpc->status && !queue_is_empty(&rpc->output)) { - stream_send_wait(rpc->stream); + if (!rpc->status) { + stream_run_wait(rpc->stream); + if (!queue_is_empty(&rpc->output)) { + stream_send_wait(rpc->stream); + } } } @@ -721,7 +726,10 @@ jsonrpc_session_run(struct jsonrpc_session *s) jsonrpc_session_disconnect(s); } } else if (s->stream) { - int error = stream_connect(s->stream); + int error; + + stream_run(s->stream); + error = stream_connect(s->stream); if (!error) { reconnect_connected(s->reconnect, time_msec()); s->rpc = jsonrpc_open(s->stream); @@ -763,6 +771,7 @@ jsonrpc_session_wait(struct jsonrpc_session *s) if (s->rpc) { jsonrpc_wait(s->rpc); } else if (s->stream) { + stream_run_wait(s->stream); stream_connect_wait(s->stream); } reconnect_wait(s->reconnect, time_msec());