On Wed, 2011-01-26 at 21:30 +0930, Iain Buchanan wrote:
> On Sun, 2011-01-23 at 21:28 +0000, Mark Ellis wrote:
> 
> > I actually have no idea how to fix it at the moment, but I know exactly
> > why it happens. When a device connects, we open a listening tcp server
> > on port 990 and 5679, the first is for WM5 and the second is for
> > 'legacy'. We do both because we dont know what kind it is yet. When the
> > Wm2003 device connects to port 5679, we close the server on 990 because
> > we don't need it.
> > 
> > But it doesn't close on 990, so when the device is unplugged and
> > replugged, we again open both servers, but 990 failed to close, so when
> > we try and open it we get an error.
> > 
> > I've gone right down to trying to close the file descriptor manually, no
> > good. It's bound to be something obvious. Anyone that spots it gets to
> > be King of Synce !!!!!!
> 
> can you run netstat and see what state the port is in after unplugging
> the device?  I'm a little rusty on my socket programming...
> 

netstat -l -t   shows the port 990 as still listening after the unplug,
because of the bug.

The following patch fixes it!

--- synce-device-manager.c.orig 2011-01-26 12:06:31.076751002 +0000
+++ synce-device-manager.c      2011-01-26 12:07:15.360751014 +0000
@@ -123,7 +123,7 @@
 
   GSList *device_entry_iter = priv->devices;
   while (device_entry_iter) {
-    if ((((DeviceEntry*)device_entry_iter->data)->server_990 = server) || 
(((DeviceEntry*)device_entry_iter->data)->server_5679 = server))
+    if ((((DeviceEntry*)device_entry_iter->data)->server_990 == server) || 
(((DeviceEntry*)device_entry_iter->data)->server_5679 == server))
       break;
     device_entry_iter = g_slist_next(device_entry_iter);
   }




------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
SynCE-Devel mailing list
SynCE-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synce-devel

Reply via email to