Proper closing of socket when exiting app
This commit is contained in:
parent
241937cad2
commit
af042ad66e
@ -196,23 +196,14 @@ static SOCKET clientConnect(SOCKET serverSocket, struct sockaddr_in* host)
|
||||
|
||||
void RemoteConnection_updateListner()
|
||||
{
|
||||
fd_set fds;
|
||||
struct timeval timeout;
|
||||
SOCKET clientSocket;
|
||||
struct sockaddr_in client;
|
||||
|
||||
if (RemoteConnection_connected())
|
||||
return;
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(s_serverSocket, &fds);
|
||||
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
// look for new clients
|
||||
|
||||
//if (select(0, &fds, NULL, NULL, &timeout) > 0)
|
||||
{
|
||||
clientSocket = clientConnect(s_serverSocket, &client);
|
||||
|
||||
@ -414,3 +405,14 @@ void RemoteConnection_sendKeyFrames(const char* name, struct sync_track* track)
|
||||
sendSetKeyCommandIndex((uint32_t)track_id, &track->keys[i]);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void RemoteConnection_close()
|
||||
{
|
||||
if (RemoteConnection_connected())
|
||||
{
|
||||
closesocket(s_socket);
|
||||
s_socket = INVALID_SOCKET;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ struct sync_track;
|
||||
|
||||
bool RemoteConnection_createListner();
|
||||
void RemoteConnection_updateListner();
|
||||
void RemoteConnection_close();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Talk with the demo stuff
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#import "RocketView.h"
|
||||
#include "../Editor.h"
|
||||
#include "../rlog.h"
|
||||
#include <Emgui.h>
|
||||
#include <GFXBackend.h>
|
||||
|
||||
@ -157,14 +158,5 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
-(void) dealloc
|
||||
{
|
||||
Editor_destroy();
|
||||
EMGFXBackend_destroy();
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
#import "delegate.h"
|
||||
#include "../Editor.h"
|
||||
#include "../RemoteConnection.h"
|
||||
#include "rlog.h"
|
||||
|
||||
@implementation MinimalAppAppDelegate
|
||||
|
||||
@ -20,4 +22,13 @@
|
||||
Editor_menuEvent((int)((NSButton*)sender).tag);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)aNotification
|
||||
{
|
||||
rlog(R_INFO, "Dealloc\n");
|
||||
Editor_destroy();
|
||||
RemoteConnection_close();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user