diff --git a/Platform/common/rpc/rpc_thread.h b/Platform/common/rpc/rpc_thread.h index d5f62e8db..8455ad8ae 100755 --- a/Platform/common/rpc/rpc_thread.h +++ b/Platform/common/rpc/rpc_thread.h @@ -16,7 +16,7 @@ #include #include -#define CLIENT_CONN_NUM 3 +#define CLIENT_CONN_NUM 1 struct _rpc_dispatch_thread { pthread_t thread_id; diff --git a/Platform/user/rpc/rpc_client.c b/Platform/user/rpc/rpc_client.c index 23c9224d0..285371524 100755 --- a/Platform/user/rpc/rpc_client.c +++ b/Platform/user/rpc/rpc_client.c @@ -224,6 +224,8 @@ ret_code rpc_client_call_async(rpc_client* client, char* service_name, conn = (rpc_conn*) rpc_array_index(th->req_conns, idx); th->last_conn = idx; + rpc_log_dbg("rpc_client_call_async:send_message\n"); + //write data rpc_request_format(req, conn); rpc_send_message(conn); diff --git a/Platform/user/rpc/rpc_conn.c b/Platform/user/rpc/rpc_conn.c index 09fa3b8b6..6e9199b15 100755 --- a/Platform/user/rpc/rpc_conn.c +++ b/Platform/user/rpc/rpc_conn.c @@ -407,6 +407,7 @@ static inline void rpc_send_response(rpc_conn *conn, ret_code code, if (output) { rpc_conn_addiov(conn, output, output_len); } + rpc_log_dbg("rpc_send_response: %s\n", data); rpc_send_message(conn); } diff --git a/Platform/user/rpc/rpc_request.c b/Platform/user/rpc/rpc_request.c index 22f6f6c7c..2ba7d4374 100755 --- a/Platform/user/rpc/rpc_request.c +++ b/Platform/user/rpc/rpc_request.c @@ -174,6 +174,8 @@ void rpc_request_format(const rpc_request *request, rpc_conn *c) { //body len data = rpc_vsprintf("body-len:%d\n\n", request->input_len); rpc_conn_addiov(c, data, strlen(data)); + + rpc_log_dbg("request data:%s\n", data); //body if (request->input) rpc_conn_addiov(c, request->input, request->input_len); diff --git a/Platform/user/rpc/rpc_thread.c b/Platform/user/rpc/rpc_thread.c index 7e10ac597..f1cae7460 100755 --- a/Platform/user/rpc/rpc_thread.c +++ b/Platform/user/rpc/rpc_thread.c @@ -316,6 +316,8 @@ static void* thread_write_hander(void* data) { idx = (th->last_conn + 1) % (th->req_conn_count); conn = (rpc_conn*) rpc_array_index(th->req_conns, idx); th->last_conn = idx; + + rpc_log_dbg("thread_write_hander:send_message\n"); //write data rpc_request_format(req, conn); @@ -326,11 +328,13 @@ static void* thread_write_hander(void* data) { static void* thread_client_handler(void* data) { rpc_client_thread *th = data; - pthread_mutex_t mutex = th->client->mutex; - pthread_mutex_lock(&mutex); + + //pthread_mutex_t mutex = th->client->mutex; + + pthread_mutex_lock(&(th->client->mutex); th->client->init_count++; pthread_cond_signal(&(th->client->cond)); - pthread_mutex_unlock(&mutex); + pthread_mutex_unlock(&(th->client->mutex); th->thread_receive_id = pthread_self(); ev_run(th->loop, 0); return NULL;