Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 123820 | Differences between
and this patch

Collapse All | Expand All

(-)chestnut-dialer-0.3.3.orig/chestnut_dialer/connection.py (-4 / +49 lines)
Lines 202-207 Link Here
202
      except OSError: 
200
      except OSError: 
203
	debug_msg(_("cannot chagne file permitions on '%s'") % file_name, 2)
201
	debug_msg(_("cannot chagne file permitions on '%s'") % file_name, 2)
204
    return (file_name, f)
202
    return (file_name, f)
203
  
205
  def _connection_init(self):
204
  def _connection_init(self):
206
    account = self.account
205
    account = self.account
207
    if not self._callback_answer_mode:
206
    if not self._callback_answer_mode:
Lines 380-398 Link Here
380
      self.pppd_exit_code = code / 256
380
      self.pppd_exit_code = code / 256
381
      return 0
381
      return 0
382
    return 1
382
    return 1
383
  
383
  def iteration(self):
384
  def iteration(self):
384
    account = self.account    
385
    account = self.account
386
    
387
    # Vladimir Smolyar, 02.05.2013: Check whether the interface is (still) up
388
    if not (self.linkname and re.search(r'<UP',
389
	  commands.getoutput(
390
	    "%s %s 2> /dev/null" % (chestnut_dialer.config.ifconfig, self.linkname)), re.M)):
391
	self._interface_up = 0
392
393
        
385
    if not self._interface_up:
394
    if not self._interface_up:
386
      pppd_kiled = 0
395
      pppd_kiled = 0
387
      buf = ""
396
      buf = ""
388
      t = time.time()      
397
      t = time.time()
389
      while time.time() - t < 0.1:
398
      while time.time() - t < 0.1:
390
        if select.select([self._pppd_pty], [], [], 0.02)[0]:
399
        if select.select([self._pppd_pty], [], [], 0.02)[0]:
391
          try: buf += os.read(self._pppd_pty, 1)
400
          try: buf += os.read(self._pppd_pty, 1)
392
	  except OSError: break
401
	  except OSError: break
393
        else:	 
402
        else:
394
	  break
403
	  break
404
395
      if buf == "" and not self._is_pppd_live(): pppd_kiled = 1
405
      if buf == "" and not self._is_pppd_live(): pppd_kiled = 1
406
      # Vladimir Smolyar, 02.05.2013:
407
      elif buf =="":
408
          # the buffer is empty
409
          if self.connected:
410
              #chestnut-dialer believes that it is connected, but
411
              # 1) the _interface_up = 0
412
              # 2) buf == ""
413
              # So let's check if the pppd is reconnecting already:
414
              if select.select([self._pppd_pty], [], [], 20)[0]:
415
                  # yes, it is reconnecting just now
416
                  return
417
              # no, it is not reconnecting while it should. 
418
              # So let's send a signal to it
419
              debug_msg("Sending SIGHUP",3)
420
              os.kill(self._pppd, signal.SIGHUP)
421
422
      
396
      if len(buf):
423
      if len(buf):
397
        buf = buf.replace("\r", "") 
424
        buf = buf.replace("\r", "") 
398
	self.text_queue.put(buf)
425
	self.text_queue.put(buf)
Lines 401-406 Link Here
401
	self._pppd_chars = lines[-1]
428
	self._pppd_chars = lines[-1]
402
	lines[-1:] = []
429
	lines[-1:] = []
403
	for s in lines:	  
430
	for s in lines:	  
431
          #killing because of a low speed
404
          if not self.speed:
432
          if not self.speed:
405
	    m = self._speed_re.match(s)
433
	    m = self._speed_re.match(s)
406
	    if m: 
434
	    if m: 
Lines 474-480 Link Here
474
	self.connected = 1
503
	self.connected = 1
475
	if account['connect_program']:
504
	if account['connect_program']:
476
          os.system(account['connect_program'])
505
          os.system(account['connect_program'])
506
      else:
507
          # the interface is down, thus it is not connected
508
          self.connected = 0
509
477
      if not pppd_kiled: return
510
      if not pppd_kiled: return
511
512
    # Vladimir Smolyar, 02.05.2013: 
513
    # Deleting the chat and password temporary files moved down,
514
    # after the pppd is surely killed.
515
    # Otherwise it leads to an error when pppd wishes to reconnect and
516
    # cannot find the temporary chat file.
517
    
518
    if self._is_pppd_live(): return
519
520
    # Vladimir Smolyar, 02.05.2013:
521
    # deleting the chat and password temporary files
478
    if self._chat_temp_file:
522
    if self._chat_temp_file:
479
      debug_msg(_("removing chat temp file"), 3)
523
      debug_msg(_("removing chat temp file"), 3)
480
      os.unlink(self._chat_temp_file)
524
      os.unlink(self._chat_temp_file)
Lines 483-489 Link Here
483
      debug_msg(_("removing password temp file"), 3)
527
      debug_msg(_("removing password temp file"), 3)
484
      os.unlink(self._passwd_temp_file)
528
      os.unlink(self._passwd_temp_file)
485
      self._passwd_temp_file = None
529
      self._passwd_temp_file = None
486
    if self._is_pppd_live(): return
530
    
531
    
487
    os.close(self._pppd_pty)
532
    os.close(self._pppd_pty)
488
    if self._passwdfdr:
533
    if self._passwdfdr:
489
      try: os.close(self._passwdfdr)
534
      try: os.close(self._passwdfdr)
(-)chestnut-dialer-0.3.3.orig/chestnut_dialer/gtk2_ui/application.py (+12 lines)
Lines 270-277 Link Here
270
    self.set_mode("Connecting")
270
    self.set_mode("Connecting")
271
    self.set_icon("connecting")
271
    self.set_icon("connecting")
272
    self.update_main_window_title()
272
    self.update_main_window_title()
273
 
274
    # Vladimir Smolyar, 02.05.2013: 
275
    # delete the timer in order to avoid multiple connection monitor timers
276
    if self.connection_monitor_tid != None:
277
        gobject.source_remove(self.connection_monitor_tid)
273
    self.connection_monitor_tid = gobject.timeout_add(300, self.gtk_timeout,
278
    self.connection_monitor_tid = gobject.timeout_add(300, self.gtk_timeout,
274
        self.connection_monitor_signal)
279
        self.connection_monitor_signal)
280
  
275
  def on_connection_setup(self):
281
  def on_connection_setup(self):
276
    self.set_mode("Status")
282
    self.set_mode("Status")
277
    self.set_icon("connected")
283
    self.set_icon("connected")
Lines 281-294 Link Here
281
    self.connection_monitor_tid = gobject.timeout_add(
287
    self.connection_monitor_tid = gobject.timeout_add(
282
        int(self.config.monitor_period * 1000),
288
        int(self.config.monitor_period * 1000),
283
        self.gtk_timeout, self.connection_monitor_signal)
289
        self.gtk_timeout, self.connection_monitor_signal)
290
    # Vladimir Smolyar, 02.05.2013: 
291
    # delete the timer in order to avoid multiple status update timers
292
    if self.update_status_tid != None:
293
        gobject.source_remove(self.update_status_tid)
284
    self.update_status_tid = gobject.timeout_add(
294
    self.update_status_tid = gobject.timeout_add(
285
      int(self.config.status_refresh_period * 1000), 
295
      int(self.config.status_refresh_period * 1000), 
286
      self.update_status_monitor)
296
      self.update_status_monitor)
297
  
287
  def on_connection_setup_extra(self):
298
  def on_connection_setup_extra(self):
288
    try: action = self.config.gtk2_ui.on_connect
299
    try: action = self.config.gtk2_ui.on_connect
289
    except AttributeError: action = ""
300
    except AttributeError: action = ""
290
    if action == "iconify" and self.main_window:
301
    if action == "iconify" and self.main_window:
291
      self.main_window.iconify()
302
      self.main_window.iconify()
303
  
292
  def on_connection_stop(self, reason):
304
  def on_connection_stop(self, reason):
293
    gobject.source_remove(self.connection_monitor_tid)
305
    gobject.source_remove(self.connection_monitor_tid)
294
    if self.update_status_tid != None:
306
    if self.update_status_tid != None:

Return to bug 123820