Update of /cvsroot/playerstage/code/player/libplayertcp
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10464/player/libplayertcp
Modified Files:
playertcp.cc playertcp.h playerudp.cc playerudp.h
remote_driver.cc remote_driver.h
Log Message:
applied Toby's autopointer patches
Index: playertcp.h
===================================================================
RCS file: /cvsroot/playerstage/code/player/libplayertcp/playertcp.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** playertcp.h 10 Jul 2007 09:01:52 -0000 1.22
--- playertcp.h 23 Aug 2007 19:58:42 -0000 1.23
***************
*** 144,148 ****
int Listen(int* ports, int num_ports);
! MessageQueue* AddClient(struct sockaddr_in* cliaddr,
unsigned int local_host,
unsigned int local_port,
--- 144,148 ----
int Listen(int* ports, int num_ports);
! QueuePointer AddClient(struct sockaddr_in* cliaddr,
unsigned int local_host,
unsigned int local_port,
***************
*** 159,163 ****
void ParseBuffer(int cli);
int HandlePlayerMessage(int cli, Message* msg);
! void DeleteClient(MessageQueue* q);
bool Listening(int port);
uint32_t GetHost() {return host;};
--- 159,163 ----
void ParseBuffer(int cli);
int HandlePlayerMessage(int cli, Message* msg);
! void DeleteClient(QueuePointer &q);
bool Listening(int port);
uint32_t GetHost() {return host;};
Index: remote_driver.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/libplayertcp/remote_driver.cc,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** remote_driver.cc 10 Jul 2007 09:01:52 -0000 1.18
--- remote_driver.cc 23 Aug 2007 19:58:42 -0000 1.19
***************
*** 230,233 ****
--- 230,234 ----
GlobalTime->GetTimeDouble(&t1);
numbytes = 0;
+
while(numbytes < encode_msglen)
{
***************
*** 378,382 ****
int
! TCPRemoteDriver::ProcessMessage(MessageQueue* resp_queue,
player_msghdr * hdr,
void * data)
--- 379,383 ----
int
! TCPRemoteDriver::ProcessMessage(QueuePointer &resp_queue,
player_msghdr * hdr,
void * data)
***************
*** 389,393 ****
{
// Re-publish the message for local consumers
! this->Publish(NULL, hdr, data);
return(0);
}
--- 390,394 ----
{
// Re-publish the message for local consumers
! this->Publish(hdr, data);
return(0);
}
Index: remote_driver.h
===================================================================
RCS file: /cvsroot/playerstage/code/player/libplayertcp/remote_driver.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** remote_driver.h 10 Jul 2007 09:01:52 -0000 1.7
--- remote_driver.h 23 Aug 2007 19:58:42 -0000 1.8
***************
*** 51,55 ****
PlayerTCP* ptcp;
int sock;
! MessageQueue* queue;
char ipaddr[256];
int kill_flag;
--- 51,55 ----
PlayerTCP* ptcp;
int sock;
! QueuePointer queue, ret_queue;
char ipaddr[256];
int kill_flag;
***************
*** 65,69 ****
virtual int Shutdown();
virtual void Update();
! virtual int ProcessMessage(MessageQueue* resp_queue,
player_msghdr * hdr,
void * data);
--- 65,69 ----
virtual int Shutdown();
virtual void Update();
! virtual int ProcessMessage(QueuePointer & resp_queue,
player_msghdr * hdr,
void * data);
Index: playertcp.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/libplayertcp/playertcp.cc,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** playertcp.cc 20 Aug 2007 19:42:47 -0000 1.56
--- playertcp.cc 23 Aug 2007 19:58:42 -0000 1.57
***************
*** 87,91 ****
struct sockaddr_in addr;
/** Outgoing queue for this connection */
! MessageQueue* queue;
/** Buffer in which to store partial incoming messages */
char* readbuffer;
--- 87,91 ----
struct sockaddr_in addr;
/** Outgoing queue for this connection */
! QueuePointer queue;
/** Buffer in which to store partial incoming messages */
char* readbuffer;
***************
*** 190,195 ****
}
! // Should be called with client_mutex locked
! MessageQueue*
PlayerTCP::AddClient(struct sockaddr_in* cliaddr,
unsigned int local_host,
--- 190,195 ----
}
! // should be called with client_mutex locked
! QueuePointer
PlayerTCP::AddClient(struct sockaddr_in* cliaddr,
unsigned int local_host,
***************
*** 236,241 ****
// Create an outgoing queue for this client
this->clients[j].queue =
! new MessageQueue(0,PLAYER_MSGQUEUE_DEFAULT_MAXLEN);
! assert(this->clients[j].queue);
// Create a buffer to hold incoming messages
--- 236,240 ----
// Create an outgoing queue for this client
this->clients[j].queue =
! QueuePointer(0,PLAYER_MSGQUEUE_DEFAULT_MAXLEN);
// Create a buffer to hold incoming messages
***************
*** 363,376 ****
this->clients[cli].fd = -1;
this->clients[cli].valid = 0;
! // FIXME
! // We can't delete the queue here, because there may be one or more
! // drivers that have pending requests from this client. Such a driver
! // will try to push the reply onto this queue, causing a segfault or
! // deadlock. So we'll empty the queue and just leave it hanging around,
! // which is a (small) memory leak.
! //delete this->clients[cli].queue;
! Message* msg;
! while((msg = this->clients[cli].queue->Pop()))
! delete msg;
free(this->clients[cli].readbuffer);
free(this->clients[cli].writebuffer);
--- 362,366 ----
this->clients[cli].fd = -1;
this->clients[cli].valid = 0;
! this->clients[cli].queue = QueuePointer();
free(this->clients[cli].readbuffer);
free(this->clients[cli].writebuffer);
***************
*** 491,495 ****
// Should be called with clients_mutex lock held
void
! PlayerTCP::DeleteClient(MessageQueue* q)
{
// Find the client and mark it for deletion.
--- 481,485 ----
// Should be called with clients_mutex lock held
void
! PlayerTCP::DeleteClient(QueuePointer &q)
{
// Find the client and mark it for deletion.
Index: playerudp.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/libplayertcp/playerudp.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** playerudp.cc 10 Jul 2007 09:01:52 -0000 1.5
--- playerudp.cc 23 Aug 2007 19:58:42 -0000 1.6
***************
*** 85,89 ****
struct sockaddr_in addr;
/** Outgoing queue for this connection */
! MessageQueue* queue;
/** Buffer in which to store partial incoming messages */
char* readbuffer;
--- 85,89 ----
struct sockaddr_in addr;
/** Outgoing queue for this connection */
! QueuePointer queue;
/** Buffer in which to store partial incoming messages */
char* readbuffer;
***************
*** 189,193 ****
// Should be called with client_mutex locked
! MessageQueue*
PlayerUDP::AddClient(struct sockaddr_in* cliaddr,
unsigned int local_host,
--- 189,193 ----
// Should be called with client_mutex locked
! QueuePointer
PlayerUDP::AddClient(struct sockaddr_in* cliaddr,
unsigned int local_host,
***************
*** 226,231 ****
// Create an outgoing queue for this client
this->clients[j].queue =
! new MessageQueue(0,PLAYER_MSGQUEUE_DEFAULT_MAXLEN);
! assert(this->clients[j].queue);
// Create a buffer to hold incoming messages
--- 226,230 ----
// Create an outgoing queue for this client
this->clients[j].queue =
! QueuePointer(0,PLAYER_MSGQUEUE_DEFAULT_MAXLEN);
// Create a buffer to hold incoming messages
Index: playerudp.h
===================================================================
RCS file: /cvsroot/playerstage/code/player/libplayertcp/playerudp.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** playerudp.h 10 Jul 2007 09:01:52 -0000 1.2
--- playerudp.h 23 Aug 2007 19:58:42 -0000 1.3
***************
*** 113,117 ****
int Listen(int* ports, int num_ports);
! MessageQueue* AddClient(struct sockaddr_in* cliaddr,
unsigned int local_host,
unsigned int local_port,
--- 113,117 ----
int Listen(int* ports, int num_ports);
! QueuePointer AddClient(struct sockaddr_in* cliaddr,
unsigned int local_host,
unsigned int local_port,
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit