mirror of
https://github.com/haiwen/libsearpc.git
synced 2025-06-22 03:37:03 +00:00
commit
317877f996
@ -158,7 +158,6 @@ failed:
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SearpcNamedPipeServer *server;
|
|
||||||
SearpcNamedPipe connfd;
|
SearpcNamedPipe connfd;
|
||||||
} ServerHandlerData;
|
} ServerHandlerData;
|
||||||
|
|
||||||
@ -169,7 +168,6 @@ static void* named_pipe_listen(void *arg)
|
|||||||
while (1) {
|
while (1) {
|
||||||
int connfd = accept (server->pipe_fd, NULL, 0);
|
int connfd = accept (server->pipe_fd, NULL, 0);
|
||||||
ServerHandlerData *data = g_malloc(sizeof(ServerHandlerData));
|
ServerHandlerData *data = g_malloc(sizeof(ServerHandlerData));
|
||||||
data->server = server;
|
|
||||||
data->connfd = connfd;
|
data->connfd = connfd;
|
||||||
g_thread_pool_push (server->named_pipe_server_thread_pool, data, NULL);
|
g_thread_pool_push (server->named_pipe_server_thread_pool, data, NULL);
|
||||||
}
|
}
|
||||||
@ -209,7 +207,6 @@ static void* named_pipe_listen(void *arg)
|
|||||||
/* g_debug ("Accepted a named pipe client\n"); */
|
/* g_debug ("Accepted a named pipe client\n"); */
|
||||||
|
|
||||||
ServerHandlerData *data = g_malloc(sizeof(ServerHandlerData));
|
ServerHandlerData *data = g_malloc(sizeof(ServerHandlerData));
|
||||||
data->server = server;
|
|
||||||
data->connfd = connfd;
|
data->connfd = connfd;
|
||||||
g_thread_pool_push (server->named_pipe_server_thread_pool, data, NULL);
|
g_thread_pool_push (server->named_pipe_server_thread_pool, data, NULL);
|
||||||
}
|
}
|
||||||
@ -220,7 +217,6 @@ static void* named_pipe_listen(void *arg)
|
|||||||
static void named_pipe_client_handler(void *data, void *user_data)
|
static void named_pipe_client_handler(void *data, void *user_data)
|
||||||
{
|
{
|
||||||
ServerHandlerData *handler_data = data;
|
ServerHandlerData *handler_data = data;
|
||||||
// SearpcNamedPipeServer *server = data->server;
|
|
||||||
SearpcNamedPipe connfd = handler_data->connfd;
|
SearpcNamedPipe connfd = handler_data->connfd;
|
||||||
|
|
||||||
guint32 len;
|
guint32 len;
|
||||||
@ -248,7 +244,6 @@ static void named_pipe_client_handler(void *data, void *user_data)
|
|||||||
|
|
||||||
if (pipe_read_n(connfd, buf, len) < 0 || len == 0) {
|
if (pipe_read_n(connfd, buf, len) < 0 || len == 0) {
|
||||||
g_warning("failed to read rpc request: %s\n", strerror(errno));
|
g_warning("failed to read rpc request: %s\n", strerror(errno));
|
||||||
g_free (buf);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,6 +279,8 @@ static void named_pipe_client_handler(void *data, void *user_data)
|
|||||||
DisconnectNamedPipe(connfd);
|
DisconnectNamedPipe(connfd);
|
||||||
CloseHandle(connfd);
|
CloseHandle(connfd);
|
||||||
#endif // !defined(WIN32)
|
#endif // !defined(WIN32)
|
||||||
|
g_free (data);
|
||||||
|
g_free (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ typedef int SearpcNamedPipe;
|
|||||||
struct _SearpcNamedPipeServer {
|
struct _SearpcNamedPipeServer {
|
||||||
char path[4096];
|
char path[4096];
|
||||||
pthread_t listener_thread;
|
pthread_t listener_thread;
|
||||||
GList *handlers;
|
|
||||||
SearpcNamedPipe pipe_fd;
|
SearpcNamedPipe pipe_fd;
|
||||||
GThreadPool *named_pipe_server_thread_pool;
|
GThreadPool *named_pipe_server_thread_pool;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user