/head: changeset 67

More working!
This commit is contained in:
jgoerzen 2002-07-04 03:14:07 +01:00
parent cabb768745
commit f53273ffc3
5 changed files with 12 additions and 2 deletions

View File

@ -85,7 +85,8 @@ def syncaccount(accountname, *args):
# Connect to the remote server. # Connect to the remote server.
server = imapserver.IMAPServer(user, passwords[accountname], server = imapserver.IMAPServer(user, passwords[accountname],
host, port, ssl) host, port, ssl,
config.getint(accountname, "maxconnections"))
remoterepos = repository.IMAP.IMAPRepository(config, accountname, server) remoterepos = repository.IMAP.IMAPRepository(config, accountname, server)
# Connect to the Maildirs. # Connect to the Maildirs.

View File

@ -17,6 +17,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import __main__ import __main__
from threading import *
class BaseFolder: class BaseFolder:
def getname(self): def getname(self):

View File

@ -127,7 +127,7 @@ class IMAPFolder(BaseFolder):
self.messagelist[uid]['flags'] = imaputil.flagsimap2maildir(flags) self.messagelist[uid]['flags'] = imaputil.flagsimap2maildir(flags)
def addmessagesflags(self, uidlist, flags): def addmessagesflags(self, uidlist, flags):
imapobj = self.imapserver.acquireconnection(imapobj) imapobj = self.imapserver.acquireconnection()
try: try:
imapobj.select(self.getfullname()) imapobj.select(self.getfullname())
r = imapobj.uid('store', r = imapobj.uid('store',

View File

@ -18,6 +18,7 @@
from offlineimap import imaplib, imaputil, threadutil from offlineimap import imaplib, imaputil, threadutil
from threading import * from threading import *
import sys
class UsefulIMAPMixIn: class UsefulIMAPMixIn:
def getstate(self): def getstate(self):
@ -81,6 +82,8 @@ class IMAPServer:
self.availableconnections.append(connection) self.availableconnections.append(connection)
self.connectionlock.release() self.connectionlock.release()
self.semaphore.release() self.semaphore.release()
print "%d connections used after release" % len(self.assignedconnections)
sys.stdout.flush()
def acquireconnection(self): def acquireconnection(self):
@ -98,6 +101,8 @@ class IMAPServer:
self.assignedconnections.append(imapobj) self.assignedconnections.append(imapobj)
del(self.availableconnections[0]) del(self.availableconnections[0])
self.connectionlock.release() self.connectionlock.release()
print "%d connections used after acquire" % len(self.assignedconnections)
sys.stdout.flush()
return imapobj return imapobj
self.connectionlock.release() # Release until need to modify data self.connectionlock.release() # Release until need to modify data
@ -119,6 +124,8 @@ class IMAPServer:
self.connectionlock.acquire() self.connectionlock.acquire()
self.assignedconnections.append(imapobj) self.assignedconnections.append(imapobj)
self.connectionlock.release() self.connectionlock.release()
print "%d connections used after acquire" % len(self.assignedconnections)
sys.stdout.flush()
return imapobj return imapobj
def connectionwait(self): def connectionwait(self):

View File

@ -8,6 +8,7 @@ class TTYUI(UIBase):
def _msg(s, msg): def _msg(s, msg):
print msg print msg
sys.stdout.flush()
def getpass(s, accountname, config): def getpass(s, accountname, config):
return getpass("%s: Enter password for %s on %s: " % return getpass("%s: Enter password for %s on %s: " %