fixing Phi device upload, adding actions for bidirectionnal git mirrors
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include <Daemon.h>
|
||||
#include <CommandBuffer.h>
|
||||
#include <Daemon.h>
|
||||
#include <Logger.h>
|
||||
#include <Memory.h>
|
||||
|
||||
@@ -50,7 +50,7 @@ scif_epd_t StartDaemon()
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(scif_listen(endpoint, 1) < 0)
|
||||
if(scif_listen(endpoint, 16) < 0)
|
||||
{
|
||||
PhiLogError("Could not listen to SCIF port");
|
||||
scif_close(endpoint);
|
||||
|
||||
@@ -25,7 +25,7 @@ int HandleAllocMemory(scif_epd_t endpoint, const PhiMessageHeader* header)
|
||||
if(ReadAll(endpoint, &request, sizeof(request)) < 0)
|
||||
return -1;
|
||||
|
||||
void* memory = malloc((size_t)request.size);
|
||||
const void* memory = malloc((size_t)request.size);
|
||||
|
||||
if(memory == NULL)
|
||||
{
|
||||
|
||||
+29
-3
@@ -1,13 +1,35 @@
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <Daemon.h>
|
||||
#include <Logger.h>
|
||||
|
||||
static void* HandleClient(void* const argument)
|
||||
{
|
||||
scif_epd_t client = (scif_epd_t)(intptr_t)argument;
|
||||
|
||||
(void)HandlePacket(client);
|
||||
scif_close(client);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
scif_epd_t endpoint = StartDaemon();
|
||||
pthread_attr_t client_thread_attributes;
|
||||
|
||||
if(endpoint == 0)
|
||||
return 1;
|
||||
|
||||
if(pthread_attr_init(&client_thread_attributes) != 0 ||
|
||||
pthread_attr_setdetachstate(&client_thread_attributes, PTHREAD_CREATE_DETACHED) != 0)
|
||||
{
|
||||
PhiLogError("Could not initialize client thread attributes");
|
||||
ShutdownDaemon(endpoint);
|
||||
return 1;
|
||||
}
|
||||
|
||||
for(;;)
|
||||
{
|
||||
struct scif_portID peer;
|
||||
@@ -21,11 +43,15 @@ int main(void)
|
||||
break;
|
||||
}
|
||||
|
||||
(void)HandlePacket(client);
|
||||
|
||||
scif_close(client);
|
||||
pthread_t client_thread;
|
||||
if(pthread_create(&client_thread, &client_thread_attributes, HandleClient, (void*)(intptr_t)client) != 0)
|
||||
{
|
||||
PhiLogError("Could not create SCIF client thread");
|
||||
scif_close(client);
|
||||
}
|
||||
}
|
||||
|
||||
pthread_attr_destroy(&client_thread_attributes);
|
||||
ShutdownDaemon(endpoint);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user